<div dir="ltr"><div><div>Hello, i&#39;m trying to set BLF on my snom 320 phone to get notification on function key for certain extension as well registered against kamailio.<br>Any other info i can provide except the following one and as well i want to exuse me, as i&#39;m pretty noob to all this, and my question might be silly, but after hours in front of google i found no solution :)<br>
<br>I always get that:<br><br>  after pua_set_publish()  **<br> 3(7825) ERROR: *** cfgtrace: c=[/usr/local/etc/kamailio/kamailio.cfg] l=791 a=16 n=if<br> 3(7825) ERROR: *** cfgtrace: c=[/usr/local/etc/kamailio/kamailio.cfg] l=780 a=41 n=isflagset<br>
 3(7825) ERROR: *** cfgtrace: c=[/usr/local/etc/kamailio/kamailio.cfg] l=799 a=16 n=if<br> 3(7825) ERROR: *** cfgtrace: c=[/usr/local/etc/kamailio/kamailio.cfg] l=791 a=25 n=save<br> 3(7825) ERROR: pua [send_publish.c:578]: New PUBLISH and no body found- invalid request<br>
 3(7825) ERROR: pua_usrloc [ul_publish.c:326]: while sending publish<br> 3(7825) ERROR: pua_usrloc [ul_publish.c:327]: TEST: type &amp; UL_CONTACT_UPDATE is 2, and error is -1   <br> (^^^ This line was added by me into module as i saw related thread and the patch solution, though it never meets condition and fails to insert from there as well.)<br>
 3(7825) ERROR: *** cfgtrace: c=[/usr/local/etc/kamailio/kamailio.cfg] l=799 a=2 n=exit<br><br><br><br></div><div>my configs are :<br></div>in BLF i set <br><br>&lt;sip:666@SERV_IP;user=phone&gt;<br><br></div>in cfg i have<br>
<br><br><div><div><br>alias=&quot;SERV_IP&quot;<br>listen=udp:SERV_IP<br>port=5060<br><br>loadmodule &quot;db_mysql.so&quot;<br><br>loadmodule &quot;mi_fifo.so&quot;<br>loadmodule &quot;kex.so&quot;<br>loadmodule &quot;tm.so&quot;<br>
loadmodule &quot;tmx.so&quot;<br>loadmodule &quot;sl.so&quot;<br>loadmodule &quot;rr.so&quot;<br>loadmodule &quot;pv.so&quot;<br>loadmodule &quot;maxfwd.so&quot;<br>loadmodule &quot;usrloc.so&quot;<br>loadmodule &quot;registrar.so&quot;<br>
loadmodule &quot;textops.so&quot;<br>loadmodule &quot;siputils.so&quot;<br>loadmodule &quot;xlog.so&quot;<br>loadmodule &quot;sanity.so&quot;<br>loadmodule &quot;ctl.so&quot;<br>loadmodule &quot;cfg_rpc.so&quot;<br>loadmodule &quot;mi_rpc.so&quot;<br>
loadmodule &quot;acc.so&quot;<br>loadmodule &quot;auth.so&quot;<br>loadmodule &quot;auth_db.so&quot;<br>loadmodule &quot;alias_db.so&quot;<br>loadmodule &quot;speeddial.so&quot;<br><br>...<br><br>modparam(&quot;usrloc&quot;, &quot;db_url&quot;, DBURL)<br>
modparam(&quot;usrloc&quot;, &quot;db_mode&quot;, 3)<br>modparam(&quot;usrloc&quot;, &quot;use_domain&quot;, MULTIDOMAIN)<br>...<br><br>modparam(&quot;presence&quot;, &quot;db_url&quot;, DBURL)<br>modparam(&quot;presence&quot;, &quot;subs_db_mode&quot; , 3  )<br>
#modparam(&quot;presence&quot;, &quot;publ_cache&quot;, 0)<br>modparam(&quot;presence&quot;, &quot;expires_offset&quot;, 300)<br>modparam(&quot;presence&quot;, &quot;max_expires&quot;, 3600)<br>#modparam(&quot;presence&quot;, &quot;force_active&quot;, 1)<br>
modparam(&quot;presence&quot;, &quot;db_update_period&quot;, 10)<br>modparam(&quot;presence&quot;, &quot;server_address&quot;, &quot;sip:SERV_IP:5060&quot;)<br><br><br>modparam(&quot;presence_xml&quot;, &quot;db_url&quot;, DBURL)<br>
modparam(&quot;presence_xml&quot;, &quot;force_active&quot;, 1)<br>#modparam(&quot;presence_dialoginfo&quot;, &quot;force_single_dialog&quot;, 1)<br><br>modparam(&quot;pua&quot;, &quot;db_url&quot; ,DBURL )<br>modparam(&quot;pua&quot;, &quot;db_mode&quot;, 2)<br>
modparam(&quot;pua&quot;, &quot;db_table&quot;, &quot;pua&quot;)<br>#modparam(&quot;pua&quot;, &quot;outbound_proxy&quot;, &quot;sip:SERV_IP&quot;)<br>modparam(&quot;pua&quot;, &quot;min_expires&quot;, 10)<br>modparam(&quot;pua&quot;, &quot;default_expires&quot;, 3600)<br>
modparam(&quot;pua&quot;, &quot;update_period&quot;, 60)<br>modparam(&quot;pua_usrloc&quot;, &quot;default_domain&quot;, &quot;SERV_IP&quot;)<br><br>request_route {<br><br><br><br><br>if(method==&quot;NOTIFY&quot;)<br>    {<br>
           xlog(&quot;  pua_update_contact  $rm from $fu  (IP:$si:$sp)  \n&quot;);<br>             <br>        if(!pua_update_contact())<br>             xlog(&quot;pua update failed \n&quot;);<br><br><br>        <br>    }<br>
<br><br><br>    # per request initial checks<br>    route(REQINIT);<br><br>    # NAT detection<br>    route(NATDETECT);<br><br>    # CANCEL processing<br>    if (is_method(&quot;CANCEL&quot;))<br>    {<br>        if (t_check_trans())<br>
            t_relay();<br>        exit;<br>    }<br><br>    # handle requests within SIP dialogs<br>    route(WITHINDLG);<br><br>    ### only initial requests (no To tag)<br><br>    t_check_trans();<br><br>    # authentication<br>
    route(AUTH);<br><br>    <br><br><br><br>    route(SPEEDDIAL);<br><br>    <br><br>    # record routing for dialog forming requests (in case they are routed)<br>    # - remove preloaded route headers<br>    remove_hf(&quot;Route&quot;);<br>
    if (is_method(&quot;INVITE|SUBSCRIBE&quot;))<br>        record_route();<br><br>    # account only INVITEs<br>    if (is_method(&quot;INVITE&quot;))<br>    {<br>        setflag(FLT_ACC); # do accounting<br>    }<br><br>
    # dispatch requests to foreign domains<br>    route(SIPOUT);<br><br>    ### requests for my local domains<br><br>    # handle presence related requests<br>    route(PRESENCE);<br><br>    # handle registrations<br>    route(REGISTRAR);<br>
<br>    if ($rU==$null)<br>    {<br>            <br>        # request with no Username in RURI<br>        sl_send_reply(&quot;484&quot;,&quot;Address Incomplete&quot;);<br>        exit;<br>    }<br><br>    # dispatch destinations to PSTN<br>
    route(PSTN);<br><br><br><br><br>route(DISPATCH);<br><br><br><br>    # user location service<br>    route(LOCATION);<br><br>    route(RELAY);<br>}<br><br><br>route[RELAY] {<br><br>    # enable additional event routes for forwarded requests<br>
    # - serial forking, RTP relaying handling, a.s.o.<br>    if (is_method(&quot;INVITE|SUBSCRIBE&quot;)) {<br>        t_on_branch(&quot;MANAGE_BRANCH&quot;);<br>        t_on_reply(&quot;MANAGE_REPLY&quot;);<br>    }<br>    if (is_method(&quot;INVITE&quot;)) {<br>
        t_on_failure(&quot;MANAGE_FAILURE&quot;);<br>    }<br><br>    if (!t_relay()) {<br>        sl_reply_error();<br>    }<br>    exit;<br>}<br><br># Per SIP request initial checks<br>route[REQINIT] {<br>#!ifdef WITH_ANTIFLOOD<br>
    # flood dection from same IP and traffic ban for a while<br>    # be sure you exclude checking trusted peers, such as pstn gateways<br>    # - local host excluded (e.g., loop to self)<br>    if(src_ip!=myself)<br>    {<br>
        if($sht(ipban=&gt;$si)!=$null)<br>        {<br>            # ip is already blocked<br>            xdbg(&quot;request from blocked IP - $rm from $fu (IP:$si:$sp)\n&quot;);<br>            exit;<br>        }<br>        if (!pike_check_req())<br>
        {<br>            xlog(&quot;L_ALERT&quot;,&quot;ALERT: pike blocking $rm from $fu (IP:$si:$sp)\n&quot;);<br>            $sht(ipban=&gt;$si) = 1;<br>            exit;<br>        }<br>    }<br>#!endif<br><br>    if (!mf_process_maxfwd_header(&quot;10&quot;)) {<br>
        sl_send_reply(&quot;483&quot;,&quot;Too Many Hops&quot;);<br>        exit;<br>    }<br><br>    if(!sanity_check(&quot;1511&quot;, &quot;7&quot;))<br>    {<br>        xlog(&quot;Malformed SIP message from $si:$sp\n&quot;);<br>
        exit;<br>    }<br>}<br><br># Handle requests within SIP dialogs<br>route[WITHINDLG] {<br>    if (has_totag()) {<br>        # sequential request withing a dialog should<br>        # take the path determined by record-routing<br>
        if (loose_route()) {<br>            route(DLGURI);<br>            if (is_method(&quot;BYE&quot;)) {<br>                setflag(FLT_ACC); # do accounting ...<br>                setflag(FLT_ACCFAILED); # ... even if the transaction fails<br>
            }<br>            else if ( is_method(&quot;ACK&quot;) ) {<br>                # ACK is forwarded statelessy<br>                route(NATMANAGE);<br>            }<br>            else if ( is_method(&quot;NOTIFY&quot;) ) {<br>
                # Add Record-Route for in-dialog NOTIFY as per RFC 6665.<br>                record_route();<br>                  <br>            }<br>            route(RELAY);<br>        } else {<br>            if (is_method(&quot;SUBSCRIBE&quot;) &amp;&amp; uri == myself) {<br>
                # in-dialog subscribe requests<br>                route(PRESENCE);<br>                exit;<br>            }<br>            if ( is_method(&quot;ACK&quot;) ) {<br>                if ( t_check_trans() ) {<br>
                    # no loose-route, but stateful ACK;<br>                    # must be an ACK after a 487<br>                    # or e.g. 404 from upstream server<br>                    t_relay();<br>                    exit;<br>
                } else {<br>                    # ACK without matching transaction ... ignore and discard<br>                    exit;<br>                }<br>            }<br>            sl_send_reply(&quot;404&quot;,&quot;Not here&quot;);<br>
        }<br>        exit;<br>    }<br>}<br><br># Handle SIP registrations<br>route[REGISTRAR] {<br><br>    if (is_method(&quot;REGISTER&quot;))<br>    {<br>        xlog(&quot;pua_set_publish()\n&quot;);<br>        <br>        if(!pua_set_publish())<br>
            xlog(&quot;set publish failed  \n&quot;);<br><br>        <br>        xlog(&quot; after pua_set_publish()\n&quot;);<br>            if(isflagset(FLT_NATS))<br>        {<br>            setbflag(FLB_NATB);<br>            # uncomment next line to do SIP NAT pinging <br>
            ## setbflag(FLB_NATSIPPING);<br>        }<br><br>         <br><br>        <br>        #pua_set_publish();<br>        if (!save(&quot;location&quot;))<br>        {<br>            sl_reply_error();<br>            xlog(&quot;save location failed \n&quot;);<br>
<br>        }<br>        <br><br>        exit;<br>    <br>}<br>}<br><br># USER location service<br>route[LOCATION] {<br><br>#!ifdef WITH_SPEEDIAL<br><br><br><br>if(uri=~&quot;sip:[0-9]{2}@.*&quot;)<br>        <br><br><br>
    xlog(&quot;speeddials\n&quot;);<br><br>    # search for short dialing - 2-digit extension<br>    if($rU=~&quot;^[0-9][0-9]$&quot;)<br>    if(sd_lookup(&quot;speed_dial&quot;))<br>            route(SIPOUT);<br>#!endif<br>
<br>#!ifdef WITH_ALIASDB<br>    # search in DB-based aliases<br>    if(alias_db_lookup(&quot;dbaliases&quot;))<br>        route(SIPOUT);<br>#!endif<br><br>    $avp(oexten) = $rU;<br>    if (!lookup(&quot;location&quot;)) {<br>
        $var(rc) = $rc;<br>        route(TOVOICEMAIL);<br>        t_newtran();<br>        switch ($var(rc)) {<br>            case -1:<br>            case -3:<br>                send_reply(&quot;404&quot;, &quot;Not Found&quot;);<br>
                exit;<br>            case -2:<br>                send_reply(&quot;405&quot;, &quot;Method Not Allowed&quot;);<br>                exit;<br>        }<br>    }<br><br>    # when routing via usrloc, log the missed calls also<br>
    if (is_method(&quot;INVITE&quot;))<br>    {<br>        setflag(FLT_ACCMISSED);<br>    }<br>}<br><br># Presence server route<br>route[PRESENCE] {<br>    if(!is_method(&quot;PUBLISH|SUBSCRIBE&quot;))<br>        return;<br>
<br><br>    # search for short dialing - 2-digit extension<br>    if($rU=~&quot;^[0-9][0-9]$&quot;)<br>        sd_lookup(&quot;speed_dial&quot;);<br><br>    route(SPEEDDIAL);<br><br><br><br>xlog(&quot;PUBLISH|SUBSCRIBE&quot;);<br>
<br><br>    sl_send_reply(&quot;100&quot;,&quot;trying&quot;);<br>    if (!t_newtran())<br>    {<br>        sl_reply_error();<br>        exit;<br>    };<br>    append_to_reply(&quot;Contact: &lt;sip:<a href="http://82.80.18.100:5060">82.80.18.100:5060</a>&gt;\r\n&quot;);<br>
    if(is_method(&quot;PUBLISH&quot;))<br>    {<br>        xlog(&quot;handle publish here\n&quot;);<br><br>        handle_publish();<br>        t_release();<br>    }<br>    else<br>    if( is_method(&quot;SUBSCRIBE&quot;))<br>
    {<br>         handle subscribe here \n&quot;);<br><br>        handle_subscribe();<br>        t_release();<br>    }<br>    exit;<br>}<br><br># Authentication route<br>route[AUTH] {<br>#!ifdef WITH_AUTH<br><br>#!ifdef WITH_IPAUTH<br>
    if((!is_method(&quot;REGISTER&quot;)) &amp;&amp; allow_source_address())<br>    {<br>        # source IP allowed<br>        return;<br>    }<br>#!endif<br><br>    if (is_method(&quot;REGISTER&quot;) || from_uri==myself)<br>
    {<br>        # authenticate requests<br>        if (!auth_check(&quot;$fd&quot;, &quot;subscriber&quot;, &quot;1&quot;)) {<br>            auth_challenge(&quot;$fd&quot;, &quot;0&quot;);<br>            exit;<br>        }<br>
        # user authenticated - remove auth header<br>        if(!is_method(&quot;REGISTER|PUBLISH&quot;))<br>            consume_credentials();<br>    }<br>    # if caller is not local subscriber, then check if it calls<br>
    # a local destination, otherwise deny, not an open relay here<br>    if (from_uri!=myself &amp;&amp; uri!=myself)<br>    {<br>        sl_send_reply(&quot;403&quot;,&quot;Not relaying&quot;);<br>        exit;<br>    }<br>
<br>#!endif<br>    return;<br>}<br><br># Caller NAT detection route<br>route[NATDETECT] {<br>#!ifdef WITH_NAT<br>    force_rport();<br>    if (nat_uac_test(&quot;19&quot;)) {<br>        if (is_method(&quot;REGISTER&quot;)) {<br>
            fix_nated_register();<br>        } else {<br>            add_contact_alias();<br>        }<br>        setflag(FLT_NATS);<br>    }<br>#!endif<br>    return;<br>}<br><br># RTPProxy control<br>route[NATMANAGE] {<br>
#!ifdef WITH_NAT<br>    if (is_request()) {<br>        if(has_totag()) {<br>            if(check_route_param(&quot;nat=yes&quot;)) {<br>                setbflag(FLB_NATB);<br>            }<br>        }<br>    }<br>    if (!(isflagset(FLT_NATS) || isbflagset(FLB_NATB)))<br>
        return;<br><br>    rtpproxy_manage();<br><br>    if (is_request()) {<br>        if (!has_totag()) {<br>            add_rr_param(&quot;;nat=yes&quot;);<br>        }<br>    }<br>    if (is_reply()) {<br>        if(isbflagset(FLB_NATB)) {<br>
            add_contact_alias();<br>        }<br>    }<br>#!endif<br>    return;<br>}<br><br># URI update for dialog requests<br>route[DLGURI] {<br>#!ifdef WITH_NAT<br>    if(!isdsturiset()) {<br>        handle_ruri_alias();<br>
    }<br>#!endif<br>    return;<br>}<br><br># Routing to foreign domains<br>route[SIPOUT] {<br>    if (!uri==myself)<br>    {<br>        append_hf(&quot;P-hint: outbound\r\n&quot;);<br>        route(RELAY);<br>    }<br>}<br>
<br># PSTN GW routing<br>route[PSTN] {<br>        .......<br><br>    return;<br>}<br><br># XMLRPC routing<br><br>route[XMLRPC] {<br>    ....<br>}<br>#!endif<br><br># route to voicemail server<br>route[TOVOICEMAIL] {<br>......<br>
    return;<br>}<br><br># manage outgoing branches<br>branch_route[MANAGE_BRANCH] {<br>    xdbg(&quot;new branch [$T_branch_idx] to $ru\n&quot;);<br>    route(NATMANAGE);<br>}<br><br># manage incoming replies<br>onreply_route[MANAGE_REPLY] {<br>
    xdbg(&quot;incoming reply\n&quot;);<br>    if(status=~&quot;[12][0-9][0-9]&quot;)<br>        route(NATMANAGE);<br>}<br><br># manage failure routing cases<br>failure_route[MANAGE_FAILURE] {<br>    route(NATMANAGE);<br>
<br>    if (t_is_canceled()) {<br>        exit;<br>    }<br><br>#!ifdef WITH_BLOCK3XX<br>    # block call redirect based on 3xx replies.<br>    if (t_check_status(&quot;3[0-9][0-9]&quot;)) {<br>        t_reply(&quot;404&quot;,&quot;Not found&quot;);<br>
        exit;<br>    }<br>#!endif<br><br>}<br><br><br><br><br><br><br><br>route[SPEEDDIAL] {<br>.....<br>    return;<br>    }<br><br><br>....<br><br><br><br><br><br><br></div><div><br><br><br><br><br><br><br><br></div></div>
</div>