Hi All in the list,
I want to implement a click and dial feature using the xhttp interface but also keeping working the XCAP functionality. Than I added some code about the dialog module (it's my first time I try it) so that the URL look like http://localhost:5060/sip-bridge/<from>/<to>
#!ifdef WITH_XCAPSRV #!define WITH_XHTTPAUTH event_route[xhttp:request] { xdbg("===== xhttp: request [$rv] $rm => $hu\n");
if($hu=~"^/xcap-root/") { #!ifdef WITH_XHTTPAUTH if (!www_authorize("xcap", "subscriber")) { www_challenge("xcap", "0"); exit; } #!endif set_reply_close(); set_reply_no_connect(); # xcap ops $xcapuri(u=>data) = $hu; if($xcapuri(u=>xuid)=~"^sip:.+@.+") $var(uri) = $xcapuri(u=>xuid); else if($xcapuri(u=>xuid)=~".+@.+") $var(uri) = "sip:" + $xcapuri(u=>xuid); else $var(uri) = "sip:"+ $xcapuri(u=>xuid) + "@" + $Ri; xlog("===== xhttp: $xcapuri(u=>auid) : $xcapuri(u=>xuid)\n"); if($xcapuri(u=>auid)=="xcap-caps") { $var(xbody) = "<?xml version='1.0' encoding='UTF-8'?> <xcap-caps xmlns='urn:ietf:params:xml:ns:xcap-caps'> <auids> <auid>rls-services</auid> <auid>pidf-manipulation</auid> <auid>xcap-caps</auid> <auid>resource-lists</auid> <auid>pres-rules</auid> <auid>org.openmobilealliance.pres-rules</auid> </auids> <extensions> </extensions> <namespaces> <namespace>urn:ietf:params:xml:ns:rls-services</namespace> <namespace>urn:ietf:params:xml:ns:pidf</namespace> <namespace>urn:ietf:params:xml:ns:xcap-caps</namespace> <namespace>urn:ietf:params:xml:ns:resource-lists</namespace> <namespace>urn:ietf:params:xml:ns:pres-rules</namespace> </namespaces> </xcap-caps>"; xhttp_reply("200", "ok", "application/xcap-caps+xml", "$var(xbody)"); exit; } #!ifdef WITH_XHTTPAUTH # be sure auth user access only its documents if ($au!=$(var(uri){uri.user})) { xhttp_reply("403", "Forbidden", "text/html", "<html><body>$si:$sp</body></html>"); exit; }
#!endif switch($rm) { case "PUT": xcaps_put("$var(uri)", "$hu", "$rb"); if($xcapuri(u=>auid)=~"pres-rules") { xlog("===== xhttp put: refreshing watchers for $var(uri)\n"); pres_update_watchers("$var(uri)", "presence"); pres_refresh_watchers("$var(uri)", "presence", 1); } exit; break; case "GET": xlog("===== xhttp: get $var(uri) => $hu\n"); xcaps_get("$var(uri)", "$hu"); exit; break; case "DELETE": xcaps_del("$var(uri)", "$hu"); if($xcapuri(u=>auid)=~"pres-rules") { xlog("===== xhttp del: refreshing watchers for $var(uri)\n"); pres_update_watchers("$var(uri)", "presence"); pres_refresh_watchers("$var(uri)", "presence", 1); } exit; break; } } else if($hu=~"^/sip-bridge/") {
if ( ! ( src_ip == 127.0.0.1 ) ) { xhttp_reply( "403", "Forbidden", "text/html", "<html><body>Invalid Access</body></html>" ); exit; }
$var(uri) = $hu; $var(from) = $(var(uri){s.select,2,/}); $var(to) = $(var(uri){s.select,3,/});
xdbg( "=== GOT sip-bridge between $var(caller) => $var(callee) ===" );
*dlg_bridge( $var(from), $var(to), "sip:192.168.2.92:5060" );*
}
# http ops xhttp_reply("200", "ok", "text/html", "<html><body>OK: $si:$sp</body></html>"); exit; } #!endif
but I got the error below:
Not starting : invalid configuration file!
0(22256) : <core> [cfg.y:3409]: parse error in config file //etc/kamailio/kamailio.cfg, line 986, column 17-26: function dlg_bridge: parameter 1 is not constant
0(22256) : <core> [cfg.y:3412]: parse error in config file //etc/kamailio/kamailio.cfg, line 986, column 63: bad command ERROR: bad config file (2 errors)
so my question is how can I call the dlg_bridge() passing some parameters coming from the http request?
Thanks in advance. Roberto Fichera.
On Tuesday 05 July 2011, Roberto Fichera wrote:
I want to implement a click and dial feature using the xhttp interface but also keeping working the XCAP functionality. Than I added some code about the dialog module (it's my first time I try it) so that the URL look like http://localhost:5060/sip-bridge/<from>/<to> [..] dlg_bridge( $var(from), $var(to), "sip:192.168.2.92:5060" );
Hi Roberto,
you're probably missing the quotes for the first two function arguments.
Best regards,
Henning
On 07/06/2011 11:42 AM, Henning Westerholt wrote:
On Tuesday 05 July 2011, Roberto Fichera wrote:
I want to implement a click and dial feature using the xhttp interface but also keeping working the XCAP functionality. Than I added some code about the dialog module (it's my first time I try it) so that the URL look like http://localhost:5060/sip-bridge/<from>/<to> [..] dlg_bridge( $var(from), $var(to), "sip:192.168.2.92:5060" );
Hi Roberto,
you're probably missing the quotes for the first two function arguments.
You are totally right!!!! Now it works fine!
Do you know what does means the warning below?
Jul 6 11:54:10 roberto /usr/sbin/kamailio[20457]: NOTICE: acc [acc.c:275]: ACC: transaction answered: timestamp=1309946050;method=INVITE;from_tag=533cb9e91f4b999cf76861cbb9ed54ed-1c03;to_tag=c20ede08;call_id=200dfc5a340d6ccc-20467@127.0.0.1;code=200;reason=OK;src_user=provision;src_domain=192.168.2.92;dst_ouser=roberto;dst_user=roberto;dst_domain=192.168.2.92 Jul 6 11:54:10 roberto /usr/sbin/kamailio[20457]: NOTICE: acc [acc.c:275]: ACC: transaction answered: timestamp=1309946050;method=BYE;from_tag=533cb9e91f4b999cf76861cbb9ed54ed-1c03;to_tag=c20ede08;call_id=200dfc5a340d6ccc-20467@127.0.0.1;code=500;reason=Request out of order;src_user=provision;src_domain=192.168.2.92;dst_ouser=roberto;dst_user=roberto;dst_domain=192.168.2.92 Jul 6 11:54:13 roberto /usr/sbin/kamailio[20457]: NOTICE: acc [acc.c:275]: ACC: transaction answered: timestamp=1309946053;method=INVITE;from_tag=ceec053a;to_tag=22243f6c;call_id=208a062d8ad33987373260a6bafe06a6@0.0.0.0;code=200;reason=OK;src_user=roberto;src_domain=192.168.2.92;dst_ouser=mattia;dst_user=mattia;dst_domain=192.168.2.50 Jul 6 11:54:16 roberto /usr/sbin/kamailio[20461]: NOTICE: acc [acc.c:275]: ACC: transaction answered: timestamp=1309946056;method=BYE;from_tag=ceec053a;to_tag=22243f6c;call_id=208a062d8ad33987373260a6bafe06a6@0.0.0.0;code=200;reason=OK;src_user=roberto;src_domain=192.168.2.92;dst_ouser=mattia;dst_user=mattia;dst_domain=192.168.2.50 Jul 6 11:54:17 roberto /usr/sbin/kamailio[20457]: WARNING: dialog [dlg_handlers.c:884]: unable to find dialog for NOTIFY with route param '7d2.14447fc4' [727:1291273281] Jul 6 11:54:17 roberto /usr/sbin/kamailio[20462]: WARNING: dialog [dlg_handlers.c:884]: unable to find dialog for NOTIFY with route param '7d2.14447fc4' [727:1291273281] Jul 6 11:54:21 roberto /usr/sbin/kamailio[20459]: WARNING: dialog [dlg_handlers.c:884]: unable to find dialog for NOTIFY with route param '7d2.14447fc4' [727:1291273281] Jul 6 11:54:21 roberto /usr/sbin/kamailio[20461]: WARNING: dialog [dlg_handlers.c:884]: unable to find dialog for NOTIFY with route param '7d2.14447fc4' [727:1291273281] Jul 6 11:54:25 roberto /usr/sbin/kamailio[20459]: WARNING: dialog [dlg_handlers.c:884]: unable to find dialog for NOTIFY with route param '7d2.14447fc4' [727:1291273281] Jul 6 11:54:25 roberto /usr/sbin/kamailio[20461]: WARNING: dialog [dlg_handlers.c:884]: unable to find dialog for NOTIFY with route param '7d2.14447fc4' [727:1291273281] Jul 6 11:54:29 roberto /usr/sbin/kamailio[20457]: WARNING: dialog [dlg_handlers.c:884]: unable to find dialog for NOTIFY with route param '7d2.14447fc4' [727:1291273281] Jul 6 11:54:29 roberto /usr/sbin/kamailio[20462]: WARNING: dialog [dlg_handlers.c:884]: unable to find dialog for NOTIFY with route param '7d2.14447fc4' [727:1291273281] Jul 6 11:54:33 roberto /usr/sbin/kamailio[20459]: WARNING: dialog [dlg_handlers.c:884]: unable to find dialog for NOTIFY with route param '7d2.14447fc4' [727:1291273281] Jul 6 11:54:33 roberto /usr/sbin/kamailio[20461]: WARNING: dialog [dlg_handlers.c:884]: unable to find dialog for NOTIFY with route param '7d2.14447fc4' [727:1291273281] Jul 6 11:54:37 roberto /usr/sbin/kamailio[20457]: WARNING: dialog [dlg_handlers.c:884]: unable to find dialog for NOTIFY with route param '7d2.14447fc4' [727:1291273281] Jul 6 11:54:37 roberto /usr/sbin/kamailio[20462]: WARNING: dialog [dlg_handlers.c:884]: unable to find dialog for NOTIFY with route param '7d2.14447fc4' [727:1291273281] Jul 6 11:54:41 roberto /usr/sbin/kamailio[20459]: WARNING: dialog [dlg_handlers.c:884]: unable to find dialog for NOTIFY with route param '7d2.14447fc4' [727:1291273281]
Best regards,
Henning
On Wednesday 06 July 2011, Roberto Fichera wrote:
you're probably missing the quotes for the first two function arguments.
You are totally right!!!! Now it works fine!
Hi Roberto,
good.
Do you know what does means the warning below? [..] 68.2.50 Jul 6 11:54:17 roberto /usr/sbin/kamailio[20457]: WARNING: dialog [dlg_handlers.c:884]: unable to find dialog for NOTIFY with route param '7d2.14447fc4' [727:1291273281]
This means that the module can't find an existing (stored) dialog for the routed message in question, in this case a NOTIFY.
Best regards,
Henning
On 07/07/2011 11:05 AM, Henning Westerholt wrote:
On Wednesday 06 July 2011, Roberto Fichera wrote:
you're probably missing the quotes for the first two function arguments.
You are totally right!!!! Now it works fine!
Hi Roberto,
good.
Do you know what does means the warning below? [..] 68.2.50 Jul 6 11:54:17 roberto /usr/sbin/kamailio[20457]: WARNING: dialog [dlg_handlers.c:884]: unable to find dialog for NOTIFY with route param '7d2.14447fc4' [727:1291273281]
This means that the module can't find an existing (stored) dialog for the routed message in question, in this case a NOTIFY.
Does this depends by the fact of own the dlg_bridge() works? And in case, how can I solve that problem?
Best regards,
Henning
On Thursday 07 July 2011, Roberto Fichera wrote:
Do you know what does means the warning below? [..] 68.2.50 Jul 6 11:54:17 roberto /usr/sbin/kamailio[20457]: WARNING: dialog [dlg_handlers.c:884]: unable to find dialog for NOTIFY with route param '7d2.14447fc4' [727:1291273281]
This means that the module can't find an existing (stored) dialog for the routed message in question, in this case a NOTIFY.
Does this depends by the fact of own the dlg_bridge() works? And in case, how can I solve that problem?
Hi Roberto,
I'm not 100% sure, I'm not the expert for dlg_bridge.. To be more specific (after discussion with Timo..) - the warning is emmited if the module can't find the dialog with the ID added as a route parameter to the respective message. One particiular reason is (if you don't store the dialogs in a database) a simple kamailio restart, then all existing dialog information is lost.
Best regards,
Henning
On 07/07/2011 02:51 PM, Henning Westerholt wrote:
On Thursday 07 July 2011, Roberto Fichera wrote:
Do you know what does means the warning below? [..] 68.2.50 Jul 6 11:54:17 roberto /usr/sbin/kamailio[20457]: WARNING: dialog [dlg_handlers.c:884]: unable to find dialog for NOTIFY with route param '7d2.14447fc4' [727:1291273281]
This means that the module can't find an existing (stored) dialog for the routed message in question, in this case a NOTIFY.
Does this depends by the fact of own the dlg_bridge() works? And in case, how can I solve that problem?
Hi Roberto,
Hi Henning,
I'm not 100% sure, I'm not the expert for dlg_bridge.. To be more specific (after discussion with Timo..) - the warning is emmited if the module can't find the dialog with the ID added as a route parameter to the respective message. One particiular reason is (if you don't store the dialogs in a database) a simple kamailio restart, then all existing dialog information is lost.
actually I've the following setup:
#!define DBURL "postgres://openser:openserrw@localhost/openser"
modparam("dialog", "dlg_flag", 2) modparam("dialog", "bridge_controller", "sip:controller@192.168.2.92") modparam("dialog", "db_url", DBURL )
Actually, my thought is that problem is more strictly related to the dlg_bridge() which might not track the bridged dialog.
Anyway, I'm playing with dlg_bridge() because I want to realize the logic so that two peers, and if possible more, can talk together only if authorized. The authorization might be a unique tag or transaction id, stored in a database, and valid only for the give conversation {tag, caller, callee} once started, than the tag become invalid and can't be used again.
I really like to have some suggestions about how to realize such logic, so which might be the best way to approach such problem since I'm actually a novice to Kamailio or in general with OpenSer logic. I'm actually more confident with Asterisk logic.
Best regards,
Henning