Hi,

What are you seeing on a pcap trace ans Logs?

Is the failure route working and the authenticated INVITE is bing sent out in response to the 401 or 407 ant you carrier is notresponding with a 100 trying to that?  Or is Kamaillio just resending the original INVITE without the auth?

what specifically has the carrier specified for the Auth and transport?

I'm assuming you have definded the auth variables in the modparms.


Richard



On 25/01/2026 17:52, Darren Carter via sr-users wrote:
I have been trying to get outbound calls to work, and my trunk provider required authentication for outbound calls.

My trunk is registered with UAC and I use Dispatcher to select the correct trunk for the CLI making the call.

I just can’t seem to get it working, my trunk does not know how to replay to my authenticated invite and Kamailio just retransmits until it times out.

Perhaps someone can point me in the right direction, I have looked everywhere and tried so many different appraches.

The call flow should be Client Phone -> Kamailio -> Trunk and replies, Trunk -> Kamailio -> Client Phone.

# Dispatch requests
route[DISPATCH] {
if ($var(dispatcher_set) == $null || $var(dispatcher_set) == "") {
xlog("L_INFO", "[$ci] DISPATCHER: No dispatcher set configured\n");
return;
}
# DISPATCHER_OUTBOUND_SET
# DISPATCHER_INBOUND_SET
# DISPATCHER_ASTERISK_SET
switch($var(dispatcher_set)) {
case DISPATCHER_OUTBOUND_SET:
if (!ds_select_dst(DISPATCHER_OUTBOUND_SET, "4")) {
xlog("L_ERR", "[$ci] DISPATCHER: No available outbound dispatcher destinations\n");
sl_send_reply("503", "Service Unavailable");
exit;
}
xlog("L_INFO", "[$ci] DISPATCHER: Going to <$ru> via <$du> (attrs: $xavp(_dsdst_=>attrs)) from set $var(dispatcher_set)\n");
$du = "sip:{{ kamailio_sip_host }}:{{ kamailio_sip_port }}";
$avp(auth_user) = $xavp(_dsdst_=>attrs=>auth_user);
$avp(auth_pass) = $xavp(_dsdst_=>attrs=>auth_pass);
$avp(auth_realm) = $xavp(_dsdst_=>attrs=>auth_realm);
if (is_method("INVITE")) {
t_on_failure("TRUNK_AUTH");
t_relay();
exit;
}
break;
case DISPATCHER_INBOUND_SET:
if (!ds_select_dst(DISPATCHER_INBOUND_SET, "4")) {
xlog("L_ERR", "[$ci] DISPATCHER: No available inbound dispatcher destinations\n");
sl_send_reply("503", "Service Unavailable");
exit;
}
break;
case DISPATCHER_ASTERISK_SET:
if (!ds_select_dst(DISPATCHER_ASTERISK_SET, "4")) {
xlog("L_ERR", "[$ci] DISPATCHER: No available Asterisk dispatcher destinations\n");
sl_send_reply("503", "Service Unavailable");
exit;
}
break;
default:
xlog("L_ERR", "[$ci] DISPATCHER: Invalid dispatcher set $var(dispatcher_set)\n");
sl_send_reply("500", "Internal Server Error");
exit;
}
t_on_failure("RTF_DISPATCH");
route(RELAY);
exit;
}

# Failure route - outbound trunk auth challenge handling
failure_route[TRUNK_AUTH] {
if (t_is_canceled()) {
xlog("L_INFO", "[$ci] TRUNK_AUTH: Transaction canceled\n");
exit;
}
if (t_check_status("401|407")) {
xlog("L_INFO", "[$ci] TRUNK_AUTH: Received auth challenge for outbound trunk\n"); if ($avp(auth_user) == $null || $avp(auth_pass) == $null || $avp(auth_realm) == $null) { xlog("L_WARN", "[$ci] TRUNK_AUTH: Missing UAC auth credentials, skipping uac_auth\n");
exit;
}
uac_auth();
t_relay();
exit;
}
}

Kind regards

Darren Carter




__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions 
[email protected]
To unsubscribe send an email [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions -- 
[email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to