<DIV><FONT color=#0000ff>My object</FONT>: get the dialog-based CDRs </DIV>
<DIV> </DIV>
<DIV><FONT color=#0000ff>SIP proxy</FONT>: kamailio-3.2.0</DIV>
<DIV> </DIV>
<DIV><FONT color=#0000ff>My script</FONT>:</DIV>
<DIV> </DIV>
<DIV>loadmodule "dialog.so"</DIV>
<DIV>......</DIV>
<DIV>modparam("dialog","dlg_flag",4)#Must be set to create the dialog associated to an initial request.<BR>modparam("dialog","db_url","mysql://xxx:xxx@localhost/albert")<BR>modparam("dialog","table_name","dialog")</DIV>
<DIV>.......</DIV>
<DIV>request_route{</DIV>
<DIV> if( is_method("INVITE") && !has_totag())</DIV>
<DIV> {<BR> dlg_setflag(4);</DIV>
<DIV> dlg_var(start_time)=$TS;</DIV>
<DIV> dlg_var(caller)=$fU;</DIV>
<DIV> dlg_var(caller)=$tU;<BR> } <BR> dlg_manage();</DIV>
<DIV> ......</DIV>
<DIV> # dispatch destinations to PSTN<BR> route(PSTN);</DIV>
<DIV> # user location service<BR> route(LOCATION);</DIV>
<DIV> route(RELAY);</DIV>
<DIV>}</DIV>
<DIV>.........</DIV>
<DIV>route[WITHINDLG] {<BR> if (has_totag()) {<BR> # sequential request withing a dialog should<BR> # take the path determined by record-routing<BR> if (loose_route()) {<BR> if (is_method("BYE")) {<BR> setflag(FLT_ACC); # do accounting ...<BR> setflag(FLT_ACCFAILED); # ... even if the transaction fails<BR> <BR> sql_query("cd", "insert into cdr(caller,callee,start_time,duration) values($dlg_var(caller),$dlg_var(callee),$dlg_var(start_time),$DLG_lifetime)", "rd");<BR> sql_result_free("rd"); <BR> }<BR> if (is_method("ACK")) {<BR> route(NATMANAGE); # ACK is forwarded statelessy<BR> }<BR> route(RELAY);</DIV>
<DIV>}</DIV>
<DIV>........</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><FONT color=#0000ff>My issue is</FONT> :</DIV>
<DIV> </DIV>
<DIV> The dialog records can be wrritten into the dialog table. But , the <FONT color=#ff0000>sql_query <FONT color=#000000>can not executed. So the cdr table will not get the CDRs. I don't know why. Who can help me ? </FONT></FONT></DIV>
<P><FONT color=#ff0000><FONT color=#000000> This is a simple script for testing. </FONT></FONT></P>
<P><FONT color=#ff0000><FONT color=#000000> Any suggestion will be appreciated.</FONT></FONT></P>
<P><FONT color=#ff0000><FONT color=#000000> Thank you in advance.</FONT></P></FONT>
<DIV> </DIV>
<DIV><sign signid="1">
<DIV style="FONT-FAMILY: Arial Narrow; COLOR: #909090; FONT-SIZE: 12px">------------------</DIV>
<DIV style="FONT-FAMILY: Verdana; COLOR: #000; FONT-SIZE: 14px">albert.gu</sign></DIV></DIV>