<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1254"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">why don’t you hook your http_queries up to the relevant SIP packets passing by?<div><br></div><div>INVITE -> start</div><div>180/183 -> ringing</div><div>200 -> pickup</div><div>BYE/CANCEL -> end</div><div><br></div><div>It’s quite straightforward to get that cleanly in your configfile, and it give you a massive control over things. (just be aware of packets arriving twice ;)  )</div><div><br></div><div>Anyhow, that’s how I typically handle this one. You can always also combine it with CNXCC, which is great for prepaid! Or do something from external with dlg.dlg_end to kill specific calls which are going over their limit.</div><div><br></div><div>But, I’m sure others will have even better ideas !</div><div><br></div><div>Grtz,</div><div>Davy Van De Moere</div><div><br></div><div><br><div><div>Op 12-aug.-2014, om 15:00 heeft <<a href="mailto:betul.cerit@netgsm.com.tr">betul.cerit@netgsm.com.tr</a>> <<a href="mailto:betul.cerit@netgsm.com.tr">betul.cerit@netgsm.com.tr</a>> het volgende geschreven:</div><br class="Apple-interchange-newline"><blockquote type="cite">
<div dir="ltr">
<div dir="ltr">
<div style="font-size: 12pt; font-family: Calibri;"><d iv="">Hello;</d></div><d iv=""></d></div><d iv="">I am trying to build a prepaid accounting 
system. I use dialog module's 
<div></div><d iv="">start/end event-route. When even_route[dialog:started] 
triggered, a 
<div></div><d iv="">http_query works for the started call. When 
event_route[dialog:end] triggered , a 
<div></div><d iv="">http_query works for call is ended. When http_query works  
in 
<div></div><d iv="">event_route[dialog:started], i get some CRITICAL ERROR like
<div></div><d iv="">'Aug 12 12:16:09   /usr/local/sbin/kamailio[10151]: 
CRITICAL: dialog 
<div></div><d iv="">[dlg_timer.c:205]: update_dlg_timer(): Trying to update a bogus 
dlg 
<div></div><d iv="">tl=0x7f7634d925d8 tl->next=(nil) tl->prev=(nil)'
<div></div><d iv="">'Aug 12 12:16:09   /usr/local/sbin/kamailio[10151]: 
ERROR: dialog 
<div></div><d iv="">[dlg_handlers.c:1263]: dlg_onroute(): failed to update dialog 
lifetime'
<div></div><d iv="">Http_query works very well. I can get all call information on 
Web 
<div></div><d iv="">Servers but default_time out or other timeout isn't working.
<div></div><d iv="">
<div></div><d iv="">After i commented out http_query in event_route[dialog:started] 
, it stopped giving
<div></div><d iv="">ERROR but i realized that dialog cannot uptade dialog hash map 
.I can see all finished call with "kamctl dialog show". After i closed 
<div></div><d iv="">http_query in even_route[dialog:end] , all problems are solved.
<div></div><d iv="">I think a problem occured between http_query and dialog 
event_routes.It 
<div></div><d iv="">cannot control dialog lifetime.Any idea about this problem or 
suggest an alternative way will be appreciated.My configuration is as follows.
<div></div><d iv="">
<div></div><d iv="">Best Regards
<div></div><d iv="">Betül.
<div></div><d iv="">
<div></div><d iv="">#---------------- dialog params -------------
<div></div><d iv="">#!ifdef WITH_DIALOG
<div></div><d iv="">modparam("dialog", "enable_stats", 1)
<div></div><d iv="">modparam("dialog", "hash_size", 8192)
<div></div><d iv="">modparam("dialog", "rr_param", "did")
<div></div><d iv="">modparam("dialog", "dlg_flag",4)
<div></div><d iv="">modparam("dialog", "timeout_avp", "$avp(i:10)")
<div></div><d iv="">modparam("dialog", "dlg_match_mode", 1)
<div></div><d iv="">modparam("dialog", "default_timeout", 3600)
<div></div><d iv="">modparam("dialog", "detect_spirals", 1)
<div></div><d iv="">modparam("dialog", "profiles_with_value", "userid ; opkodu ; 
useropkodu ")
<div></div><d iv="">modparam("dialog", "dlg_extra_hdrs", "Hint: Hell Yeah\r\n")
<div></div><d iv="">modparam("dialog", "send_bye", 1)
<div></div><d iv="">#!endif
<div></div><d iv="">
<div></div><d iv="">route[CHCK_DLG]{
<div></div><d iv="">
<div></div><d iv="">xlog("L_INFO","DLG:AVP=> 
:>:$avp(i:77):$avp(op_kodu):$avp(i:69) ");
<div></div><d iv="">
<div></div><d iv="">                 
$dlg_ctx(timeout_bye)=1;
<div></div><d iv="">                 
$avp(unique_id)=$sruid;
<div></div><d iv="">
<div></div><d iv="">                 
/* Time out suresi i:10 konusabilecegi sure saniye */
<div></div><d iv="">                 
$avp(i:10)=0;
<div></div><d iv="">                 
$avp(i:10)=(int)$avp(i:77);
<div></div><d iv="">                 
#$avp(i:10)=10;
<div></div><d iv="">                 
$dlg_ctx(timeout_route)=33;
<div></div><d iv="">                 
$dlg_var(uniqueid)=$avp(unique_id);
<div></div><d iv="">                 
$dlg_var(userid)=$avp(userid);
<div></div><d iv="">                 
$dlg_var(opkodu)=$avp(op_kodu);
<div></div><d iv="">
<div></div><d iv="">
<div></div><d iv="">                 
set_dlg_profile("userid","$avp(userid)");
<div></div><d iv="">                 
set_dlg_profile("opkodu","$avp(op_kodu)");
<div></div><d iv="">set_dlg_profile("useropkodu","$avp(userid):$avp(op_kodu)");
<div></div><d iv="">
<div></div><d iv="">
<div></div><d iv="">if(get_profile_size("useropkodu","$avp(d_user_opkodu)")){
<div></div><d iv="">xlog("L_INFO","Userid_Size:$avp(d_user_opkodu) kk : 
<div></div><d iv="">$avp(userid):$avp(op_kodu) ");
<div></div><d iv="">xlog("L_INFO","Userid_Limit:$sht(sayac=>$avp(userid):$avp(op_kodu))");
<div></div><d iv="">
<div></div><d iv="">if(!($sht(sayac=>$avp(userid):$avp(op_kodu))>$avp(d_user_opkodu))){
<div></div><d iv="">sl_send_reply("403","Kapasite Asildi.");
<div></div><d iv="">                                         
exit;
<div></div><d iv="">                         
}
<div></div><d iv="">                 
}
<div></div><d iv="">
<div></div><d iv="">                 
dlg_manage();
<div></div><d iv="">
<div></div><d iv="">         return;
<div></div><d iv="">}
<div></div><d iv="">
<div></div><d iv="">
<div></div><d iv="">
<div></div><d iv="">event_route[dialog:start]{
<div></div><d iv="">xlog("L_ALERT","START:CI:$dlg(callid):u_id:$dlg_var(uniqueid):U_id:$dlg_var(userid) 

<div></div><d iv="">");
<div></div><d iv="">xlog("L_ALERT","START:lifetime:$avp(i:10):opkodu:$dlg_var(opkodu):$avp(aranan)" 

<div></div><d iv="">);
<div></div><d iv="">
<div></div><d iv="">#!ifdef WITH_UTILS
<div></div><d iv="">$var(http_res)=http_query("<a href="http://bla.com/somestuff.php?userid=">http://bla.com/somestuff.php?userid=</a>$avp(userid)&aranan=$avp(aranan)&callid=$ci&uniqueid=$dlg_var(uniqueid)&lifetime=$avp(i:10)&opkodu=$dlg_var(opkodu)","$var(result)");
<div></div><d iv="">
<div></div><d iv="">         
if($var(http_res)=="200"){
<div></div><d iv="">                 
json_get_field("$var(result)","sonuc","$var(snc)");
<div></div><d iv="">json_get_field("$var(result)","yorum","$var(yorum)");
<div></div><d iv="">json_get_field("$var(result)","yorum","$var(debug)");
<div></div><d iv="">                 
if($var(snc)!=200){
<div></div><d iv="">xlog("L_ERR","START:CI:$ci:Sonuc:$var(snc):Yorum:$var(yorum):Debug:$var(debug)");
<div></div><d iv="">                 
}else{
<div></div><d iv="">xlog("L_INFO","START:CI:$ci:Sonuc:$var(snc)");
<div></div><d iv="">                 
}
<div></div><d iv="">         }else{
<div></div><d iv="">xlog("L_ERR","START:CI:$ci:HTTP_RESULT:$var(http_res)");
<div></div><d iv="">         }
<div></div><d iv="">#!endif
<div></div><d iv="">}
<div></div><d iv="">
<div></div><d iv="">
<div></div><d iv="">
<div></div><d iv="">
<div></div><d iv="">event_route[dialog:end]{
<div></div><d iv="">
<div></div><d iv="">         
xlog("L_ALERT","END 
<div></div><d iv="">::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 
:");
<div></div><d iv="">xlog("L_ALERT","END:CI:$ci:START_TIME:$dlg(start_ts):NOW:$TS");
<div></div><d iv="">         
$var(billsec)=$TS-$dlg(start_ts);
<div></div><d iv="">         
xlog("L_ALERT","END:SURE : $var(billsec): u_id: 
<div></div><d iv="">$dlg_var(uniqueid):code:$T_reply_code:$DLG_status  ");
<div></div><d iv="">xlog("L_ALERT","END:U_ID:$dlg_var(userid):O_Kodu:$dlg_var(opkodu):");
<div></div><d iv="">
<div></div><d iv="">         
if($var(billsec)<0){
<div></div><d iv="">                 
$var(billsec)=$DLG_lifetime;
<div></div><d iv="">                 
xlog("L_ERR","START:CI:$ci:Billsec Negatif geldi : 
<div></div><d iv="">lifetime alinacak:$DLG_lifetime");
<div></div><d iv="">         }
<div></div><d iv="">
<div></div><d iv="">
<div></div><d iv="">#!ifdef WITH_UTILS
<div></div><d iv="">
<div></div><d iv="">$var(http_res)=http_query("<a href="http://bla.com/somestuff.php?uniqueid=">http://bla.com/somestuff.php?uniqueid=</a>$dlg_var(uniqueid)&billsec=$var(billsec)","$var(result)");
<div></div><d iv="">
<div></div><d iv="">         
if($var(http_res)=="200"){
<div></div><d iv="">                 
json_get_field("$var(result)","sonuc","$var(snc)");
<div></div><d iv="">json_get_field("$var(result)","yorum","$var(yorum)");
<div></div><d iv="">json_get_field("$var(result)","yorum","$var(debug)");
<div></div><d iv="">                 
if($var(snc)!=200){
<div></div><d iv="">xlog("L_ERR","START:CI:$ci:Sonuc:$var(snc):Yorum:$var(yorum):Debug:$var(debug)");
<div></div><d iv="">                 
}
<div></div><d iv="">         }else{
<div></div><d iv="">xlog("L_ERR","START:CI:$ci:HTTP_RESULT:$var(http_res)");
<div></div><d iv="">         }
<div></div><d iv="">#!endif
<div></div><d iv="">         
xlog("L_ALERT","END 
<div></div><d iv="">::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 
:");
<div></div><d iv="">}
<div></div><d style="font-size: 12pt; font-family: Calibri;" iv="">
<div></div>
<div></div>
<div></div></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></d></div>
_______________________________________________<br>SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br><a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users<br></blockquote></div><br></div></body></html>