[SR-Users] Routing outgoing call from asterisk to registered SIP provider

Bruno Salzano bruno at brunosalzano.com
Thu Oct 29 06:08:12 CET 2015


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 at 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
>




More information about the sr-users mailing list