[SR-Users] Authentication against outbound carrier trunk
Krzysztof Grobelak
krzysztof.grobelak at gmail.com
Thu May 31 23:24:44 CEST 2018
Hello List,
I have a working setup with a kamailio + freeswitch where i can register
extension and make succesfull calls between them.
I added now a "external" path for outbound call to which i can
successfully route using the dialplan + dispatcher combo.
My problem is that my outbound path requires authentication and i'm
struggling to find a way to successfully authenticate with the remote end.
I configured the UAC module to register against the remote end with a
set of credentials but in the SIP trace i can see that the kamailio
simply uses the local user credentials instead of the external ones.
I believe that this is because the 401 Unauthorized from the carrier
gets proxied to the extension which responds with its own credentials.
Can anybody suggest how can i stop forwarding them in this case to
extension and instead use the UAC to reply with different set of
credentials?
Regards,
Krzysztof
The config:
request_route {
...
if($rU=~"[0-9]{5,}"){
xlog("L_INFO","Looking up route for $rU\n");
dp_match("1", "$rU");
$var(dsid) = $(var(attrs){s.int});
if(!ds_select_dst("$var(dsid)", "4")) {
send_reply("404", "No destination");
exit;
}
if(!ds_select_domain("$var(dsid)", "4")) {
send_reply("404", "No destination");
exit;
}
xlog("L_INFO", "Looking up $fn in database\n");
$avp(s:auth_realm_avp) = "realm.com";
$avp(s:auth_username_avp) = "username";
$avp(s:auth_password_avp) = "password";
if(uac_reg_request_to("$fn", 1)) {
xlog("L_INFO", "Found remote user [$rU] on [$rd] via [$du]");
t_on_failure("REMOTE_AUTH");
xlog("L_INFO", "going to <$ru> via <$du>\n");
route(RELAY);
}
exit;
}
failure_route[REMOTE_AUTH] {
if ($T_reply_code == 401 or $T_reply_code == 407) {
xlog("L_INFO", "Remote asked for authentication");
uac_auth();
}
}
--
PGP: 9E5D E635 5A03 485C 2E00 4530 EB83 920A 9E21 FBA8
More information about the sr-users
mailing list