Hello, i've DID provider that require to register to it's server. I've been able to configure this provider using kamailio and uac and to route all inbound calls from DID provider to internal asterisk media server. All is working great.
Now i need help to configure call routing from internal asterisk to the external DID provider.
I've done something like:
route[LOCATION] { if(is_method("INVITE")) { route(FROMASTERISK); route(TOASTERISK); exit; } [...] }
route[FROMASTERISK] { if (ds_is_from_list()) { xlog("L_INFO","[$fU@$si:$sp]{$rm} {$ru} Call from Media-Server Cluster\n"); rtpengine_manage("direction=internal direction=external replace-origin replace-session-connection trust-address"); $ru = "sip:TESTING_NUMBER@EXTERNAL_PROVIDER_IP"; route(RELAY); exit; } }
It seems that when i route the call outbound, i get a 407. So i would like to react to this using uac_auth() as described here: http://kamailio.org/docs/modules/4.3.x/modules/uac.html#uac.f.uac_auth()
Is this the right way? Can someone help me, giving hints and some working example?
Using kamailio 4.3.3 with rtpengine 4.1.0
Best regards, Bruno
On Tuesday 27 October 2015 07:36:15 Bruno Salzano wrote:
It seems that when i route the call outbound, i get a 407. So i would like to react to this using uac_auth() as described here: http://kamailio.org/docs/modules/4.3.x/modules/uac.html#uac.f.uac_auth()
Is this the right way? Can someone help me, giving hints and some working example?
Based on the info you have given I'd say this is correct. The working code is in the URL you provide. Adding a specific failure route in the FROMASTERISK when ds_is_from_list matches to the uac_auth() function is the way to go.
Thank you. I'll try and let you know.
Bruno
2015-10-27 11:41 GMT+01:00 Daniel Tryba d.tryba@pocos.nl:
On Tuesday 27 October 2015 07:36:15 Bruno Salzano wrote:
It seems that when i route the call outbound, i get a 407. So i would
like
to react to this using uac_auth() as described here: http://kamailio.org/docs/modules/4.3.x/modules/uac.html#uac.f.uac_auth()
Is this the right way? Can someone help me, giving hints and some working example?
Based on the info you have given I'd say this is correct. The working code is in the URL you provide. Adding a specific failure route in the FROMASTERISK when ds_is_from_list matches to the uac_auth() function is the way to go.
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Hello Daniel,
Il 27/10/15 11:41, Daniel Tryba ha scritto:
On Tuesday 27 October 2015 07:36:15 Bruno Salzano wrote:
It seems that when i route the call outbound, i get a 407. So i would like to react to this using uac_auth() as described here: http://kamailio.org/docs/modules/4.3.x/modules/uac.html#uac.f.uac_auth()
Is this the right way? Can someone help me, giving hints and some working example?
Based on the info you have given I'd say this is correct. The working code is in the URL you provide. Adding a specific failure route in the FROMASTERISK when ds_is_from_list matches to the uac_auth() function is the way to go.
I got it working. It required me to enable the track_cseq_updates in dialog module and use uac_auth(). Actually my config is the following:
route[FROMASTERISK] { if (ds_is_from_list()) { xlog("L_INFO","[$fU@$si:$sp]{$rm} {$ru} Call from Media-Server Cluster\n"); rtpengine_manage("direction=internal direction=external replace-origin replace-session-connection trust-address"); uac_replace_from("", "sip:NUMBER@HOST"); route(RELAY); exit; } }
failure_route[TRUNKAUTH] { xlog("L_INFO","TRUNKAUTH FAILURE ROUTE"); if (t_is_canceled()) { exit; } if(t_check_status("401|407")) { xlog("L_INFO", "Got 401/407 sending uac_auth() and t_relay()"); $avp(auser) = "USERNAME"; $avp(apass) = "SECRET"; $avp(arealm) = "REALM"; uac_auth(); t_relay(); exit; } }
Now I've just last question on this topic: what's the best way to replace credentials (USERNAME, SECRET, REALM) from db? I've to manage also the uac_replace_from. What I want is to avoid to change the configuration everytime a new trunk is added.
Best Regards, Bruno
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
On 27/10/15 23:44, Bruno Salzano wrote:
Hello Daniel,
Il 27/10/15 11:41, Daniel Tryba ha scritto:
On Tuesday 27 October 2015 07:36:15 Bruno Salzano wrote:
It seems that when i route the call outbound, i get a 407. So i would like to react to this using uac_auth() as described here: http://kamailio.org/docs/modules/4.3.x/modules/uac.html#uac.f.uac_auth()
Is this the right way? Can someone help me, giving hints and some working example?
Based on the info you have given I'd say this is correct. The working code is in the URL you provide. Adding a specific failure route in the FROMASTERISK when ds_is_from_list matches to the uac_auth() function is the way to go.
I got it working. It required me to enable the track_cseq_updates in dialog module and use uac_auth(). Actually my config is the following:
route[FROMASTERISK] { if (ds_is_from_list()) { xlog("L_INFO","[$fU@$si:$sp]{$rm} {$ru} Call from Media-Server Cluster\n"); rtpengine_manage("direction=internal direction=external replace-origin replace-session-connection trust-address"); uac_replace_from("", "sip:NUMBER@HOST"); route(RELAY); exit; } }
failure_route[TRUNKAUTH] { xlog("L_INFO","TRUNKAUTH FAILURE ROUTE"); if (t_is_canceled()) { exit; } if(t_check_status("401|407")) { xlog("L_INFO", "Got 401/407 sending uac_auth() and t_relay()"); $avp(auser) = "USERNAME"; $avp(apass) = "SECRET"; $avp(arealm) = "REALM"; uac_auth(); t_relay(); exit; } }
Now I've just last question on this topic: what's the best way to replace credentials (USERNAME, SECRET, REALM) from db? I've to manage also the uac_replace_from. What I want is to avoid to change the configuration everytime a new trunk is added.
You can use sqlops to load values from a database table. Or htable, which has the benefit of storing it in memory at runtime, but you can still issue reload commands when new values are set.
Cheers, Daniel
Il 28/10/15 13:45, Daniel-Constantin Mierla ha scritto:
On 27/10/15 23:44, Bruno Salzano wrote:
Hello Daniel,
Il 27/10/15 11:41, Daniel Tryba ha scritto:
On Tuesday 27 October 2015 07:36:15 Bruno Salzano wrote:
It seems that when i route the call outbound, i get a 407. So i would like to react to this using uac_auth() as described here: http://kamailio.org/docs/modules/4.3.x/modules/uac.html#uac.f.uac_auth()
Is this the right way? Can someone help me, giving hints and some working example?
Based on the info you have given I'd say this is correct. The working code is in the URL you provide. Adding a specific failure route in the FROMASTERISK when ds_is_from_list matches to the uac_auth() function is the way to go.
I got it working. It required me to enable the track_cseq_updates in dialog module and use uac_auth(). Actually my config is the following:
route[FROMASTERISK] { if (ds_is_from_list()) { xlog("L_INFO","[$fU@$si:$sp]{$rm} {$ru} Call from Media-Server Cluster\n"); rtpengine_manage("direction=internal direction=external replace-origin replace-session-connection trust-address"); uac_replace_from("", "sip:NUMBER@HOST"); route(RELAY); exit; } }
failure_route[TRUNKAUTH] { xlog("L_INFO","TRUNKAUTH FAILURE ROUTE"); if (t_is_canceled()) { exit; } if(t_check_status("401|407")) { xlog("L_INFO", "Got 401/407 sending uac_auth() and t_relay()"); $avp(auser) = "USERNAME"; $avp(apass) = "SECRET"; $avp(arealm) = "REALM"; uac_auth(); t_relay(); exit; } }
Now I've just last question on this topic: what's the best way to replace credentials (USERNAME, SECRET, REALM) from db? I've to manage also the uac_replace_from. What I want is to avoid to change the configuration everytime a new trunk is added.
You can use sqlops to load values from a database table. Or htable, which has the benefit of storing it in memory at runtime, but you can still issue reload commands when new values are set.
htable seems the best solution. Thank you!
Regards, Bruno
Cheers, Daniel
It seems that when i route the call outbound, i get a 407. So i would like to react to this using uac_auth() as described here: http://kamailio.org/docs/modules/4.3.x/modules/uac.html#uac.f.uac_auth()
Is this the right way? Can someone help me, giving hints and some working example?
Using uac_auth() is the perfect way to send calls to external provider, if you want to authorise the user. If your provider provides IP based auth, you don't need uac_auth() and you can simply terminate using the PSTN gw.
I am not if this answers your question fully,. I myself a newbie here. Tried and got a code working both for PSTN with/without uac_auth.
regards Ganesh Kumar