<div dir="ltr"><div>Hello All,</div><div><br></div><div>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.</div>
<div><br></div><div>I want to try the new call center module, but I have problems. I'm using Opensips 1.11.1 (from <a href="http://opensips.org/pub/opensips/1.11.1/src/opensips-1.11.1-0f26cc5_src.tar.gz">http://opensips.org/pub/opensips/1.11.1/src/opensips-1.11.1-0f26cc5_src.tar.gz</a>). </div>
<div>I think I've missed something.</div><div><br></div><div>Here is what I expect from the test:</div><div>1001@dark.sip calls 321 (the customer care number) and when the Agent (1000@dark.sip) is logged in, 1000 should receive the call, and 1001 should hear the </div>
<div>music on hold played from a remote Asterisk box (<a href="mailto:sip%3A789@192.168.57.3">sip:789@192.168.57.3</a>) until 1000 accepts the call.</div><div><br></div><div>Here is UL output:</div><div>bash-4.2# opensipsctl ul show</div>
<div>Domain:: location table=512 records=2</div><div> AOR:: 1000@dark.sip</div><div> Contact:: sip:1000@192.168.57.2:5060;ob Q=</div><div> Expires:: 6</div><div> Callid:: d8238fca92d546a4a02dacd49945ce09</div>
<div> Cseq:: 28989</div><div> User-agent:: MicroSIP/3.5.2</div><div> Received:: sip:<a href="http://192.168.57.2:5060">192.168.57.2:5060</a></div><div> State:: CS_SYNC</div>
<div> Flags:: 0</div><div> Cflags:: NAT</div><div> Socket:: udp:<a href="http://192.168.57.1:5060">192.168.57.1:5060</a></div><div> Methods:: 8063</div>
<div> AOR:: 1001@dark.sip</div><div> Contact:: sip:1001@192.168.57.1:5062;line=440bf1c1659e8f5 Q=</div><div> Expires:: 3419</div><div> Callid:: 1327377519</div>
<div> Cseq:: 12</div><div> User-agent:: Linphone/3.6.1 (eXosip2/3.6.0)</div><div> Received:: sip:<a href="http://192.168.57.1:5062">192.168.57.1:5062</a></div>
<div> State:: CS_SYNC</div><div> Flags:: 0</div><div> Cflags:: NAT</div><div> Socket:: udp:<a href="http://192.168.57.1:5060">192.168.57.1:5060</a></div>
<div> Methods:: 4294967295</div><div><br></div><div><br></div><div><br></div><div>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@dark.sip) doesn't ring</div>
<div>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.</div><div>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, </div>
<div>but still the call is not delivered to the Agent </div><div><br></div><div>Here is the code:</div><div>.....</div><div>loadmodule "b2b_entities.so"</div><div>modparam("b2b_entities", "db_mode", 1)</div>
<div>modparam("b2b_entities", "db_url", "mysql://opensips:opensipsrw@localhost/opensips_1_11")</div><div><br></div><div>loadmodule "b2b_logic.so"</div><div>modparam("b2b_logic", "db_mode", 1)</div>
<div>modparam("b2b_logic", "db_url", "mysql://opensips:opensipsrw@localhost/opensips_1_11")</div><div>modparam("b2b_logic", "script_scenario", "/etc/opensips/scenario_callcenter.xml")</div>
<div><br></div><div>loadmodule "call_center.so"</div><div>modparam("call_center", "db_url", "mysql://opensips:opensipsrw@localhost/opensips_1_11")</div><div>modparam("call_center", "acc_db_url", "mysql://opensips:opensipsrw@localhost/opensips_1_11")</div>
<div>modparam("call_center", "b2b_scenario", "call center")</div><div>.....</div><div><br></div><div>route{</div><div>......</div><div><br></div><div><span class="" style="white-space:pre">        </span>$var(flowid)="support";</div>
<div><span class="" style="white-space:pre">        </span>if($rU=="321") {</div><div><span class="" style="white-space:pre">                </span>if (is_method("INVITE") and !has_totag()) {</div><div><span class="" style="white-space:pre">                        </span>if (!cc_handle_call("$var(flowid)")) {</div>
<div><span class="" style="white-space:pre">                                </span>send_reply("403","Cannot handle call");</div><div><span class="" style="white-space:pre">                                </span>exit;</div><div><span class="" style="white-space:pre">                        </span>}</div>
<div><span class="" style="white-space:pre">                </span>exit;</div><div><span class="" style="white-space:pre">                </span>}</div><div><span class="" style="white-space:pre">        </span>}</div><div><br></div><div>.....</div><div><br>
</div><div><br></div><div><br></div><div><br></div><div>And below are the database contents:</div><div><br></div><div>MariaDB [opensips_1_11]> select * from cc_agents;</div><div>+----+---------+----------------------------+----------+----------+---------------+</div>
<div>| id | agentid | location | logstate | skills | last_call_end |</div><div>+----+---------+----------------------------+----------+----------+---------------+</div><div>| 1 | 1000 | <a href="http://sip:1000@192.168.57.2:5060">sip:1000@192.168.57.2:5060</a> | 1 | custcare | 0 |</div>
<div>+----+---------+----------------------------+----------+----------+---------------+</div><div>1 row in set (0.00 sec)</div><div><br></div><div>MariaDB [opensips_1_11]> select * from cc_flows;</div><div>+----+---------+----------+----------+------------+-----------------+----------------------+</div>
<div>| id | flowid | priority | skill | prependcid | message_welcome | message_queue |</div><div>+----+---------+----------+----------+------------+-----------------+----------------------+</div><div>| 2 | support | 256 | custcare | | NULL | <a href="mailto:sip%3A789@192.168.57.3">sip:789@192.168.57.3</a> |</div>
<div>+----+---------+----------+----------+------------+-----------------+----------------------+</div><div>1 row in set (0.00 sec)</div><div><br></div><div>MariaDB [opensips_1_11]> select * from cc_calls;</div><div>+----+-------+----------+--------+------------+-----+------------+-----------+-----------+-----------+---------+---------+-------+</div>
<div>| id | state | ig_cback | no_rej | setup_time | eta | last_start | recv_time | caller_dn | caller_un | b2buaid | flow | agent |</div><div>+----+-------+----------+--------+------------+-----+------------+-----------+-----------+-----------+---------+---------+-------+</div>
<div>| 37 | 3 | 0 | 0 | -1 | 0 | 99 | 99 | 1001 | 1001 | 943.0 | support | 1000 |</div><div>+----+-------+----------+--------+------------+-----+------------+-----------+-----------+-----------+---------+---------+-------+</div>
<div>1 row in set (0.00 sec)</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div>Every time 1001 calls 321, I get the following log</div><div><br>
</div><div>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' </div><div>May 14 09:33:12 darkstar /sbin/opensips[7494]: ERROR:core:db_do_insert: error while submitting query </div>
<div>May 14 09:33:12 darkstar /sbin/opensips[7494]: ERROR:call_center:cc_db_insert_call: inserting new record in database </div><div>May 14 09:33:12 darkstar /sbin/opensips[7494]: ERROR:call_center:w_handle_call: Failed to insert call record in db </div>
<div><br></div><div><br></div><div><br></div><div><br></div><div>I checked my MySQL log, and I see something like the following </div><div><br></div><div><br></div><div>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@dark.sip','sip:1001@dark.sip','','sip:321@dark.sip','','','','udp:<a href="http://192.168.57.1:5060">192.168.57.1:5060</a>','943.0',1,21,1,0,0,21,'<a href="http://sip:1001@192.168.57.1:5062">sip:1001@192.168.57.1:5062</a>','sip:<a href="http://192.168.57.1:5060">192.168.57.1:5060</a>')</div>
<div>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','<a href="mailto:sip%3A789@192.168.57.3">sip:789@192.168.57.3</a>','','','','','',1,1,1400057835,0,'server1','sip:321@dark.sip','sip:1001@dark.sip','B2B.15.62',1,'client1','<a href="mailto:sip%3A789@192.168.57.3">sip:789@192.168.57.3</a>','sip:1001@dark.sip','B2B.252.8053748')</div>
<div>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','')</div>
<div>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@dark.sip','','<a href="mailto:sip%3A789@192.168.57.3">sip:789@192.168.57.3</a>','','','','udp:<a href="http://192.168.57.1:5060">192.168.57.1:5060</a>','943.0',4,22,1,1,0,22,'sip:<a href="http://192.168.57.1:5060">192.168.57.1:5060</a>','<a href="http://sip:789@192.168.57.3:5060">sip:789@192.168.57.3:5060</a>','as79f2b584',22,'<a href="http://sip:789@192.168.57.3:5060">sip:789@192.168.57.3:5060</a>','')</div>
<div>Query update b2b_logic set sstate=1,next_sstate=1,lifetime=1400100975,e1_type=0,e1_sid='server1',e1_to='sip:321@dark.sip',e1_from='sip:1001@dark.sip',e1_key='B2B.15.62',e2_type=1,e2_sid='client1',e2_to='<a href="mailto:sip%3A789@192.168.57.3">sip:789@192.168.57.3</a>',e2_from='sip:1001@dark.sip',e2_key='B2B.252.8053748' where si_key='943.0'</div>
<div>Query update b2b_entities set state=5,cseq0=22,cseq1=1,lm=4,lrc=0,lic=22,contact0='sip:<a href="http://192.168.57.1:5060">192.168.57.1:5060</a>',contact1='<a href="http://sip:789@192.168.57.3:5060">sip:789@192.168.57.3:5060</a>',leg_tag='as79f2b584',leg_cseq=22,leg_contact='<a href="http://sip:789@192.168.57.3:5060">sip:789@192.168.57.3:5060</a>',leg_route='' where type=1 AND tag0='e86fcb40bafe3c72250681c6aca3fa92-c0ef' AND tag1='as79f2b584' AND callid='B2B.252.8053748'</div>
<div>Query update b2b_logic set sstate=1,next_sstate=1,lifetime=1400100975,e1_type=0,e1_sid='server1',e1_to='sip:321@dark.sip',e1_from='sip:1001@dark.sip',e1_key='B2B.15.62',e2_type=1,e2_sid='client1',e2_to='<a href="mailto:sip%3A789@192.168.57.3">sip:789@192.168.57.3</a>',e2_from='sip:1001@dark.sip',e2_key='B2B.252.8053748' where si_key='943.0'</div>
<div>Query update b2b_entities set state=5,cseq0=21,cseq1=1,lm=0,lrc=200,lic=21,contact0='<a href="http://sip:1001@192.168.57.1:5062">sip:1001@192.168.57.1:5062</a>',contact1='sip:<a href="http://192.168.57.1:5060">192.168.57.1:5060</a>' where type=0 AND tag0='265302590' AND tag1='B2B.15.62' AND callid='1805953653'</div>
<div>Query delete from b2b_entities where type=1 AND tag0='e86fcb40bafe3c72250681c6aca3fa92-c0ef' AND tag1='as79f2b584' AND callid='B2B.252.8053748'</div><div>Query update b2b_logic set sstate=-2,next_sstate=1,lifetime=1400057814,e1_type=0,e1_sid='server1',e1_to='sip:321@dark.sip',e1_from='sip:1001@dark.sip',e1_key='B2B.15.62',e2_type=1,e2_sid='client1',e2_to='<a href="mailto:sip%3A789@192.168.57.3">sip:789@192.168.57.3</a>',e2_from='sip:1001@dark.sip',e2_key='B2B.252.8053748' where si_key='943.0'</div>
<div>Query delete from b2b_entities where type=0 AND tag0='265302590' AND tag1='B2B.15.62' AND callid='1805953653'</div><div>Query delete from b2b_entities where type=0 AND tag0='265302590' AND tag1='B2B.15.62' AND callid='1805953653'</div>
<div>Query delete from b2b_logic where si_key='943.0'</div><div>Query delete from b2b_entities where param='943.0'</div><div><br></div><div><br></div><div>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@dark.sip','sip:1001@dark.sip','','sip:321@dark.sip','','','','udp:<a href="http://192.168.57.1:5060">192.168.57.1:5060</a>','943.0',1,21,1,0,0,21,'<a href="http://sip:1001@192.168.57.1:5062">sip:1001@192.168.57.1:5062</a>','sip:<a href="http://192.168.57.1:5060">192.168.57.1:5060</a>')</div>
<div>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','<a href="mailto:sip%3A789@192.168.57.3">sip:789@192.168.57.3</a>','','','','','',1,1,1400057866,0,'server1','sip:321@dark.sip','sip:1001@dark.sip','B2B.406.2',1,'client1','<a href="mailto:sip%3A789@192.168.57.3">sip:789@192.168.57.3</a>','sip:1001@dark.sip','B2B.252.3775340')</div>
<div>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','')</div>
<div>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@dark.sip','','<a href="mailto:sip%3A789@192.168.57.3">sip:789@192.168.57.3</a>','','','','udp:<a href="http://192.168.57.1:5060">192.168.57.1:5060</a>','943.0',4,22,1,1,0,22,'sip:<a href="http://192.168.57.1:5060">192.168.57.1:5060</a>','<a href="http://sip:789@192.168.57.3:5060">sip:789@192.168.57.3:5060</a>','as7277702c',22,'<a href="http://sip:789@192.168.57.3:5060">sip:789@192.168.57.3:5060</a>','')</div>
<div>Query update b2b_logic set sstate=1,next_sstate=1,lifetime=1400101006,e1_type=0,e1_sid='server1',e1_to='sip:321@dark.sip',e1_from='sip:1001@dark.sip',e1_key='B2B.406.2',e2_type=1,e2_sid='client1',e2_to='<a href="mailto:sip%3A789@192.168.57.3">sip:789@192.168.57.3</a>',e2_from='sip:1001@dark.sip',e2_key='B2B.252.3775340' where si_key='943.0'</div>
<div>Query update b2b_entities set state=5,cseq0=22,cseq1=1,lm=4,lrc=0,lic=22,contact0='sip:<a href="http://192.168.57.1:5060">192.168.57.1:5060</a>',contact1='<a href="http://sip:789@192.168.57.3:5060">sip:789@192.168.57.3:5060</a>',leg_tag='as7277702c',leg_cseq=22,leg_contact='<a href="http://sip:789@192.168.57.3:5060">sip:789@192.168.57.3:5060</a>',leg_route='' where type=1 AND tag0='e86fcb40bafe3c72250681c6aca3fa92-c0ef' AND tag1='as7277702c' AND callid='B2B.252.3775340'</div>
<div>Query update b2b_logic set sstate=1,next_sstate=1,lifetime=1400101006,e1_type=0,e1_sid='server1',e1_to='sip:321@dark.sip',e1_from='sip:1001@dark.sip',e1_key='B2B.406.2',e2_type=1,e2_sid='client1',e2_to='<a href="mailto:sip%3A789@192.168.57.3">sip:789@192.168.57.3</a>',e2_from='sip:1001@dark.sip',e2_key='B2B.252.3775340' where si_key='943.0'</div>
<div>Query update b2b_entities set state=5,cseq0=21,cseq1=1,lm=0,lrc=200,lic=21,contact0='<a href="http://sip:1001@192.168.57.1:5062">sip:1001@192.168.57.1:5062</a>',contact1='sip:<a href="http://192.168.57.1:5060">192.168.57.1:5060</a>' where type=0 AND tag0='1426943035' AND tag1='B2B.406.2' AND callid='271697631'</div>
<div>Query delete from b2b_entities where type=1 AND tag0='e86fcb40bafe3c72250681c6aca3fa92-c0ef' AND tag1='as7277702c' AND callid='B2B.252.3775340'</div><div>Query update b2b_logic set sstate=-2,next_sstate=1,lifetime=1400057840,e1_type=0,e1_sid='server1',e1_to='sip:321@dark.sip',e1_from='sip:1001@dark.sip',e1_key='B2B.406.2',e2_type=1,e2_sid='client1',e2_to='<a href="mailto:sip%3A789@192.168.57.3">sip:789@192.168.57.3</a>',e2_from='sip:1001@dark.sip',e2_key='B2B.252.3775340' where si_key='943.0'</div>
<div>Query delete from b2b_entities where type=0 AND tag0='1426943035' AND tag1='B2B.406.2' AND callid='271697631'</div><div>Query delete from b2b_entities where type=0 AND tag0='1426943035' AND tag1='B2B.406.2' AND callid='271697631'</div>
<div>Query delete from b2b_logic where si_key='943.0'</div><div>Query delete from b2b_entities where param='943.0'</div><div><br></div><div><br></div><div><br></div><div>Your help is really appreciated. And sorry for my poor english</div>
<div><br></div><div>Best Regards,</div><div><br></div><div>Garmin</div></div>