[OpenSIPS-Users] Opensips Call Center problems
Răzvan Crainea
razvan at opensips.org
Wed May 14 15:25:52 CEST 2014
Hi, Garmin!
First of all, please truncate the cc_calls table. This should prevent
the mysql duplicate error.
Next make the call. According to your previous mail, you are hearing the
queue message provided by the Asterisk box, right? If so, please run the
following opensipsctl commands:
opensipsctl fifo cc_list_queue
opensipsctl fifo cc_list_flows
opensipsctl fifo cc_list_agents
opensipsctl fifo cc_list_calls
If possible, please provide (via pastebin) the debug log of the call
(privately if you want).
Best regards,
Razvan Crainea
OpenSIPS Core Developer
http://www.opensips-solutions.com
On 05/14/2014 12:16 PM, Garmin Sag wrote:
> Hello All,
>
> I'm new to Opensips (and especially all the B2B stuff), so please
> forgive my ignorance. It's my first post to the list, so if it's not the
> right place to ask for help, then please forgive me.
>
> I want to try the new call center module, but I have problems. I'm using
> Opensips 1.11.1 (from
> http://opensips.org/pub/opensips/1.11.1/src/opensips-1.11.1-0f26cc5_src.tar.gz).
>
> I think I've missed something.
>
> Here is what I expect from the test:
> 1001 at dark.sip calls 321 (the customer care number) and when the Agent
> (1000 at dark.sip) is logged in, 1000 should receive the call, and 1001
> should hear the
> music on hold played from a remote Asterisk box (sip:789 at 192.168.57.3
> <mailto:sip%3A789 at 192.168.57.3>) until 1000 accepts the call.
>
> Here is UL output:
> bash-4.2# opensipsctl ul show
> Domain:: location table=512 records=2
> AOR:: 1000 at dark.sip
> Contact:: sip:1000 at 192.168.57.2:5060;ob Q=
> Expires:: 6
> Callid:: d8238fca92d546a4a02dacd49945ce09
> Cseq:: 28989
> User-agent:: MicroSIP/3.5.2
> Received:: sip:192.168.57.2:5060
> <http://192.168.57.2:5060>
> State:: CS_SYNC
> Flags:: 0
> Cflags:: NAT
> Socket:: udp:192.168.57.1:5060
> <http://192.168.57.1:5060>
> Methods:: 8063
> AOR:: 1001 at dark.sip
> Contact::
> sip:1001 at 192.168.57.1:5062;line=440bf1c1659e8f5 Q=
> Expires:: 3419
> Callid:: 1327377519
> Cseq:: 12
> User-agent:: Linphone/3.6.1 (eXosip2/3.6.0)
> Received:: sip:192.168.57.1:5062
> <http://192.168.57.1:5062>
> State:: CS_SYNC
> Flags:: 0
> Cflags:: NAT
> Socket:: udp:192.168.57.1:5060
> <http://192.168.57.1:5060>
> Methods:: 4294967295
>
>
>
> When 1001 dial 321, it's connected to the music on hold on the remote
> asterisk box (192.168.57.3), but the Agent (1000 at dark.sip) doesn't ring
> When I log off the agent using "opensipsctl fifo cc_agent_login 1000 0",
> then 1001 cannot call 321 ("Cannot handle call") and that's normal I think.
> When I log the Agent in using "opensipsctl fifo cc_agent_login 1000 1",
> then 1001 can call 321 and stay in queue while connected to the music on
> hold,
> but still the call is not delivered to the Agent
>
> Here is the code:
> .....
> loadmodule "b2b_entities.so"
> modparam("b2b_entities", "db_mode", 1)
> modparam("b2b_entities", "db_url",
> "mysql://opensips:opensipsrw@localhost/opensips_1_11")
>
> loadmodule "b2b_logic.so"
> modparam("b2b_logic", "db_mode", 1)
> modparam("b2b_logic", "db_url",
> "mysql://opensips:opensipsrw@localhost/opensips_1_11")
> modparam("b2b_logic", "script_scenario",
> "/etc/opensips/scenario_callcenter.xml")
>
> loadmodule "call_center.so"
> modparam("call_center", "db_url",
> "mysql://opensips:opensipsrw@localhost/opensips_1_11")
> modparam("call_center", "acc_db_url",
> "mysql://opensips:opensipsrw@localhost/opensips_1_11")
> modparam("call_center", "b2b_scenario", "call center")
> .....
>
> route{
> ......
>
> $var(flowid)="support";
> if($rU=="321") {
> if (is_method("INVITE") and !has_totag()) {
> if (!cc_handle_call("$var(flowid)")) {
> send_reply("403","Cannot handle call");
> exit;
> }
> exit;
> }
> }
>
> .....
>
>
>
>
> And below are the database contents:
>
> MariaDB [opensips_1_11]> select * from cc_agents;
> +----+---------+----------------------------+----------+----------+---------------+
> | id | agentid | location | logstate | skills |
> last_call_end |
> +----+---------+----------------------------+----------+----------+---------------+
> | 1 | 1000 | sip:1000 at 192.168.57.2:5060
> <http://sip:1000@192.168.57.2:5060> | 1 | custcare | 0 |
> +----+---------+----------------------------+----------+----------+---------------+
> 1 row in set (0.00 sec)
>
> MariaDB [opensips_1_11]> select * from cc_flows;
> +----+---------+----------+----------+------------+-----------------+----------------------+
> | id | flowid | priority | skill | prependcid | message_welcome |
> message_queue |
> +----+---------+----------+----------+------------+-----------------+----------------------+
> | 2 | support | 256 | custcare | | NULL |
> sip:789 at 192.168.57.3 <mailto:sip%3A789 at 192.168.57.3> |
> +----+---------+----------+----------+------------+-----------------+----------------------+
> 1 row in set (0.00 sec)
>
> MariaDB [opensips_1_11]> select * from cc_calls;
> +----+-------+----------+--------+------------+-----+------------+-----------+-----------+-----------+---------+---------+-------+
> | id | state | ig_cback | no_rej | setup_time | eta | last_start |
> recv_time | caller_dn | caller_un | b2buaid | flow | agent |
> +----+-------+----------+--------+------------+-----+------------+-----------+-----------+-----------+---------+---------+-------+
> | 37 | 3 | 0 | 0 | -1 | 0 | 99 |
> 99 | 1001 | 1001 | 943.0 | support | 1000 |
> +----+-------+----------+--------+------------+-----+------------+-----------+-----------+-----------+---------+---------+-------+
> 1 row in set (0.00 sec)
>
>
>
>
>
>
>
>
> Every time 1001 calls 321, I get the following log
>
> May 14 09:33:12 darkstar /sbin/opensips[7494]:
> CRITICAL:db_mysql:wrapper_single_mysql_real_query: driver error (1062):
> Duplicate entry '943.0' for key 'PRIMARY'
> May 14 09:33:12 darkstar /sbin/opensips[7494]: ERROR:core:db_do_insert:
> error while submitting query
> May 14 09:33:12 darkstar /sbin/opensips[7494]:
> ERROR:call_center:cc_db_insert_call: inserting new record in database
> May 14 09:33:12 darkstar /sbin/opensips[7494]:
> ERROR:call_center:w_handle_call: Failed to insert call record in db
>
>
>
>
> I checked my MySQL log, and I see something like the following
>
>
> Query insert into b2b_entities
> (type,tag0,tag1,callid,ruri,from_uri,from_dname,to_uri,to_dname,route0,route1,sockinfo_srv,param,state,cseq0,cseq1,lm,lrc,lic,contact0,contact1
> ) values
> (0,'265302590','B2B.15.62','1805953653','sip:321 at dark.sip','sip:1001 at dark.sip','','sip:321 at dark.sip','','','','udp:192.168.57.1:5060
> <http://192.168.57.1:5060>','943.0',1,21,1,0,0,21,'sip:1001 at 192.168.57.1:5062
> <http://sip:1001@192.168.57.1:5062>','sip:192.168.57.1:5060
> <http://192.168.57.1:5060>')
> Query insert into b2b_logic
> (si_key,scenario,sparam0,sparam1,sparam2,sparam3,sparam4,sdp,sstate,next_sstate,lifetime,e1_type,e1_sid,e1_to,e1_from,e1_key,e2_type,e2_sid,e2_to,e2_from,e2_key
> ) values ('943.0','call center','sip:789 at 192.168.57.3
> <mailto:sip%3A789 at 192.168.57.3>','','','','','',1,1,1400057835,0,'server1','sip:321 at dark.sip','sip:1001 at dark.sip','B2B.15.62',1,'client1','sip:789 at 192.168.57.3
> <mailto:sip%3A789 at 192.168.57.3>','sip:1001 at dark.sip','B2B.252.8053748')
> Query insert into cc_calls
> (state,ig_cback,no_rej,setup_time,eta,last_start,recv_time,caller_dn,caller_un,b2buaid,flow,agent
> ) values (2,0,0,-1,0,1623,1623,'1001','1001','943.0','support','')
> Query insert into b2b_entities
> (type,tag0,tag1,callid,ruri,from_uri,from_dname,to_uri,to_dname,route0,route1,sockinfo_srv,param,state,cseq0,cseq1,lm,lrc,lic,contact0,contact1,leg_tag,leg_cseq,leg_contact,leg_route
> ) values
> (1,'e86fcb40bafe3c72250681c6aca3fa92-c0ef','as79f2b584','B2B.252.8053748','','sip:1001 at dark.sip','','sip:789 at 192.168.57.3
> <mailto:sip%3A789 at 192.168.57.3>','','','','udp:192.168.57.1:5060
> <http://192.168.57.1:5060>','943.0',4,22,1,1,0,22,'sip:192.168.57.1:5060
> <http://192.168.57.1:5060>','sip:789 at 192.168.57.3:5060
> <http://sip:789@192.168.57.3:5060>','as79f2b584',22,'sip:789 at 192.168.57.3:5060
> <http://sip:789@192.168.57.3:5060>','')
> Query update b2b_logic set
> sstate=1,next_sstate=1,lifetime=1400100975,e1_type=0,e1_sid='server1',e1_to='sip:321 at dark.sip',e1_from='sip:1001 at dark.sip',e1_key='B2B.15.62',e2_type=1,e2_sid='client1',e2_to='sip:789 at 192.168.57.3
> <mailto:sip%3A789 at 192.168.57.3>',e2_from='sip:1001 at dark.sip',e2_key='B2B.252.8053748'
> where si_key='943.0'
> Query update b2b_entities set
> state=5,cseq0=22,cseq1=1,lm=4,lrc=0,lic=22,contact0='sip:192.168.57.1:5060
> <http://192.168.57.1:5060>',contact1='sip:789 at 192.168.57.3:5060
> <http://sip:789@192.168.57.3:5060>',leg_tag='as79f2b584',leg_cseq=22,leg_contact='sip:789 at 192.168.57.3:5060
> <http://sip:789@192.168.57.3:5060>',leg_route='' where type=1 AND
> tag0='e86fcb40bafe3c72250681c6aca3fa92-c0ef' AND tag1='as79f2b584' AND
> callid='B2B.252.8053748'
> Query update b2b_logic set
> sstate=1,next_sstate=1,lifetime=1400100975,e1_type=0,e1_sid='server1',e1_to='sip:321 at dark.sip',e1_from='sip:1001 at dark.sip',e1_key='B2B.15.62',e2_type=1,e2_sid='client1',e2_to='sip:789 at 192.168.57.3
> <mailto:sip%3A789 at 192.168.57.3>',e2_from='sip:1001 at dark.sip',e2_key='B2B.252.8053748'
> where si_key='943.0'
> Query update b2b_entities set
> state=5,cseq0=21,cseq1=1,lm=0,lrc=200,lic=21,contact0='sip:1001 at 192.168.57.1:5062
> <http://sip:1001@192.168.57.1:5062>',contact1='sip:192.168.57.1:5060
> <http://192.168.57.1:5060>' where type=0 AND tag0='265302590' AND
> tag1='B2B.15.62' AND callid='1805953653'
> Query delete from b2b_entities where type=1 AND
> tag0='e86fcb40bafe3c72250681c6aca3fa92-c0ef' AND tag1='as79f2b584' AND
> callid='B2B.252.8053748'
> Query update b2b_logic set
> sstate=-2,next_sstate=1,lifetime=1400057814,e1_type=0,e1_sid='server1',e1_to='sip:321 at dark.sip',e1_from='sip:1001 at dark.sip',e1_key='B2B.15.62',e2_type=1,e2_sid='client1',e2_to='sip:789 at 192.168.57.3
> <mailto:sip%3A789 at 192.168.57.3>',e2_from='sip:1001 at dark.sip',e2_key='B2B.252.8053748'
> where si_key='943.0'
> Query delete from b2b_entities where type=0 AND tag0='265302590' AND
> tag1='B2B.15.62' AND callid='1805953653'
> Query delete from b2b_entities where type=0 AND tag0='265302590' AND
> tag1='B2B.15.62' AND callid='1805953653'
> Query delete from b2b_logic where si_key='943.0'
> Query delete from b2b_entities where param='943.0'
>
>
> Query insert into b2b_entities
> (type,tag0,tag1,callid,ruri,from_uri,from_dname,to_uri,to_dname,route0,route1,sockinfo_srv,param,state,cseq0,cseq1,lm,lrc,lic,contact0,contact1
> ) values
> (0,'1426943035','B2B.406.2','271697631','sip:321 at dark.sip','sip:1001 at dark.sip','','sip:321 at dark.sip','','','','udp:192.168.57.1:5060
> <http://192.168.57.1:5060>','943.0',1,21,1,0,0,21,'sip:1001 at 192.168.57.1:5062
> <http://sip:1001@192.168.57.1:5062>','sip:192.168.57.1:5060
> <http://192.168.57.1:5060>')
> Query insert into b2b_logic
> (si_key,scenario,sparam0,sparam1,sparam2,sparam3,sparam4,sdp,sstate,next_sstate,lifetime,e1_type,e1_sid,e1_to,e1_from,e1_key,e2_type,e2_sid,e2_to,e2_from,e2_key
> ) values ('943.0','call center','sip:789 at 192.168.57.3
> <mailto:sip%3A789 at 192.168.57.3>','','','','','',1,1,1400057866,0,'server1','sip:321 at dark.sip','sip:1001 at dark.sip','B2B.406.2',1,'client1','sip:789 at 192.168.57.3
> <mailto:sip%3A789 at 192.168.57.3>','sip:1001 at dark.sip','B2B.252.3775340')
> Query insert into cc_calls
> (state,ig_cback,no_rej,setup_time,eta,last_start,recv_time,caller_dn,caller_un,b2buaid,flow,agent
> ) values (2,0,0,-1,0,1655,1655,'1001','1001','943.0','support','')
> Query insert into b2b_entities
> (type,tag0,tag1,callid,ruri,from_uri,from_dname,to_uri,to_dname,route0,route1,sockinfo_srv,param,state,cseq0,cseq1,lm,lrc,lic,contact0,contact1,leg_tag,leg_cseq,leg_contact,leg_route
> ) values
> (1,'e86fcb40bafe3c72250681c6aca3fa92-c0ef','as7277702c','B2B.252.3775340','','sip:1001 at dark.sip','','sip:789 at 192.168.57.3
> <mailto:sip%3A789 at 192.168.57.3>','','','','udp:192.168.57.1:5060
> <http://192.168.57.1:5060>','943.0',4,22,1,1,0,22,'sip:192.168.57.1:5060
> <http://192.168.57.1:5060>','sip:789 at 192.168.57.3:5060
> <http://sip:789@192.168.57.3:5060>','as7277702c',22,'sip:789 at 192.168.57.3:5060
> <http://sip:789@192.168.57.3:5060>','')
> Query update b2b_logic set
> sstate=1,next_sstate=1,lifetime=1400101006,e1_type=0,e1_sid='server1',e1_to='sip:321 at dark.sip',e1_from='sip:1001 at dark.sip',e1_key='B2B.406.2',e2_type=1,e2_sid='client1',e2_to='sip:789 at 192.168.57.3
> <mailto:sip%3A789 at 192.168.57.3>',e2_from='sip:1001 at dark.sip',e2_key='B2B.252.3775340'
> where si_key='943.0'
> Query update b2b_entities set
> state=5,cseq0=22,cseq1=1,lm=4,lrc=0,lic=22,contact0='sip:192.168.57.1:5060
> <http://192.168.57.1:5060>',contact1='sip:789 at 192.168.57.3:5060
> <http://sip:789@192.168.57.3:5060>',leg_tag='as7277702c',leg_cseq=22,leg_contact='sip:789 at 192.168.57.3:5060
> <http://sip:789@192.168.57.3:5060>',leg_route='' where type=1 AND
> tag0='e86fcb40bafe3c72250681c6aca3fa92-c0ef' AND tag1='as7277702c' AND
> callid='B2B.252.3775340'
> Query update b2b_logic set
> sstate=1,next_sstate=1,lifetime=1400101006,e1_type=0,e1_sid='server1',e1_to='sip:321 at dark.sip',e1_from='sip:1001 at dark.sip',e1_key='B2B.406.2',e2_type=1,e2_sid='client1',e2_to='sip:789 at 192.168.57.3
> <mailto:sip%3A789 at 192.168.57.3>',e2_from='sip:1001 at dark.sip',e2_key='B2B.252.3775340'
> where si_key='943.0'
> Query update b2b_entities set
> state=5,cseq0=21,cseq1=1,lm=0,lrc=200,lic=21,contact0='sip:1001 at 192.168.57.1:5062
> <http://sip:1001@192.168.57.1:5062>',contact1='sip:192.168.57.1:5060
> <http://192.168.57.1:5060>' where type=0 AND tag0='1426943035' AND
> tag1='B2B.406.2' AND callid='271697631'
> Query delete from b2b_entities where type=1 AND
> tag0='e86fcb40bafe3c72250681c6aca3fa92-c0ef' AND tag1='as7277702c' AND
> callid='B2B.252.3775340'
> Query update b2b_logic set
> sstate=-2,next_sstate=1,lifetime=1400057840,e1_type=0,e1_sid='server1',e1_to='sip:321 at dark.sip',e1_from='sip:1001 at dark.sip',e1_key='B2B.406.2',e2_type=1,e2_sid='client1',e2_to='sip:789 at 192.168.57.3
> <mailto:sip%3A789 at 192.168.57.3>',e2_from='sip:1001 at dark.sip',e2_key='B2B.252.3775340'
> where si_key='943.0'
> Query delete from b2b_entities where type=0 AND tag0='1426943035'
> AND tag1='B2B.406.2' AND callid='271697631'
> Query delete from b2b_entities where type=0 AND tag0='1426943035'
> AND tag1='B2B.406.2' AND callid='271697631'
> Query delete from b2b_logic where si_key='943.0'
> Query delete from b2b_entities where param='943.0'
>
>
>
> Your help is really appreciated. And sorry for my poor english
>
> Best Regards,
>
> Garmin
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
More information about the Users
mailing list