[SR-Users] Kamailio PSTN with User/Pass authentication

Barthel Marco (CI/AFU1) Marco.Barthel at de.bosch.com
Wed Sep 23 09:59:23 CEST 2015


That's what we used:




modparam("uac","auth_realm_avp","$avp(s:auth_realm_avp)")
modparam("uac","auth_username_avp","$avp(s:auth_username_avp)")
modparam("uac","auth_password_avp","$avp(s:auth_password_avp)")



route[HANDLE_PROXY_AUTH_RESPONSE_M]
{
    if ($T_reply_code == "407")  # there's also 401
    {
        $avp(s:auth_realm_avp) = "whichever realm is used";
        $avp(s:auth_username_avp) = "someuser";
        $avp(s:auth_password_avp) = "somesecret";
        
        if (uac_auth())
        {
            xlog("L_INFO", "$var(tan)[HANDLE_PROXY_AUTH_RESPONSE_M] did auth. Relaying to new destination. from=$fu, callee-selected-by=$ou, uri=$ru");
            route(RELAY_ROUTE_C);  # doing the relay here
            exit;
        }
        else
        {
            xlog("L_INFO", "$var(tan)[HANDLE_PROXY_AUTH_RESPONSE_M] no matching realm found. realm=$ar");
        }
    }
}



failure_route[STD_FAILURE_ROUTE] 
{
    # ...
    route(HANDLE_PROXY_AUTH_RESPONSE_M);
    # ...
    
}

Mit freundlichen Grüßen / Best regards

 Marco Barthel

Robert Bosch GmbH
 (CI/AFU1) 
Postfach 30 02 20
70442 Stuttgart
GERMANY
www.bosch.com

Sitz: Stuttgart, Registergericht: Amtsgericht Stuttgart, HRB 14000; 
Aufsichtsratsvorsitzender: Franz Fehrenbach; Geschäftsführung: Dr. Volkmar Denner, 
Dr. Stefan Asenkerschbaumer, Dr. Rolf Bulander, Dr. Stefan Hartung, Dr. Markus Heyn, Dr. Dirk Hoheisel,
Christoph Kübel, Uwe Raschke, Dr. Werner Struth, Peter Tyroller


> -----Original Message-----
> From: sr-users [mailto:sr-users-bounces at lists.sip-router.org] On Behalf Of
> Infinicalls Infinicalls
> Sent: Montag, 21. September 2015 17:09
> To: Kamailio (SER) - Users Mailing List <sr-users at lists.sip-router.org>
> Subject: [SR-Users] Kamailio PSTN with User/Pass authentication
> 
> Hi,
>  I am trying to add PSTN gw for terminating my calls. I have changed the IP in the
> kamailio.cfg file, but this provider wants digest auth and so I need to pass
> api/pass to them. Can somebody guide me how and where to add the
> username+pass to the config file.
> 
> thanks
> 
> regards
> Ganesh Kuamr
> 
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-
> users at lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users



More information about the sr-users mailing list