<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Hello,</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
As mobile applications based on kamailio are growing exponentially on Play Store and App Store, i would suggest if you could add by default the code for ios/android push notifications.
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
I have problems mainly for incoming call (phone wakeup) on linphone iphone app, as kamailio is missing the push solution. On Android i am using Baresip and works perfect without push.<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Navigating on the web, i found some uncomplete or minimum tutorials to implement this.
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Like: <a href="https://denys-pozniak.medium.com/apple-push-notification-with-kamailio-eeca2f8e08d" id="LPlnk">
https://denys-pozniak.medium.com/apple-push-notification-with-kamailio-eeca2f8e08d</a><br>
</div>
<div class="_Entity _EType_OWALinkPreview _EId_OWALinkPreview _EReadonly_1"></div>
<br>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
And also some code snippets of a modification of "kamailio.cfg" to add support for ios push notifications. (see below).<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Could someone have this already working? Or kamailio official developers could add this by default inside source code?<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<blockquote style="border-color: rgb(200, 200, 200); border-left: 3px solid rgb(200, 200, 200); padding-left: 1ex; margin-left: 0.8ex; color: rgb(102, 102, 102);" itemscope="" itemtype="https://schemas.microsoft.com/QuotedText">
<div>
<p style="margin-top:0;margin-bottom:0"><font face="monospace"># keep a record of an IPhone for 4 hours<br>
modparam("htable", "htable", "iphone_remote=>size=10;autoexpire=14400;")<br>
modparam("htable", "htable", "iphone_voip=>size=10;autoexpire=14400;")<br>
modparam("htable", "htable", "iphone_check=>size=10;autoexpire=14400;")<br>
modparam("htable", "htable", "vtp=>size=10;autoexpire=120;")<br>
</font><br>
</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"><font face="monospace">route[REGISTRAR] {</font></p>
<p style="margin-top:0;margin-bottom:0"><font face="monospace">...</font></p>
<p style="margin-top:0;margin-bottom:0"><font face="monospace">...<br>
</font></p>
<p style="margin-top:0;margin-bottom:0"><font face="monospace">        if (save("location")) {<br>
<br>
            # user registered, now look at the useragent header for iPhone string<br>
            if ($hdr(User-Agent)=~"LinphoneiOS.*") {<br>
<br>
<br>
                $var(uri) = @contact.uri;                               # select the uri from contact header<br>
                $var(pn-prid) = $(var(uri){uri.param,pn-prid});         # get the uri param pn-prid from the uri, i.e. 1DF26BC10F597676B<br>
                xlog("!!!! - $var(pn-prid)");<br>
                $var(i) = 0;<br>
                $var(n) = $(var(pn-prid){s.count,&});<br>
<br>
                while( $var(i) <= $var(n)) {<br>
                    $var(pn-prid_item) = $(var(pn-prid){s.select,$var(i),&});<br>
                    $var(pn-prid_type) = $(var(pn-prid_item){s.select,1,:});<br>
                    $var(pn-prid_token) = $(var(pn-prid_item){s.select,0,:});<br>
<br>
                    if ( $var(pn-prid_type) == "remote" ) {<br>
                        $var(pn-prid_remote) = $(var(pn-prid_item){s.select,0,:}) ;<br>
                    }<br>
                    if ( $var(pn-prid_type) == "voip" ) {<br>
                        $var(pn-prid_voip) = $(var(pn-prid_item){s.select,0,:}) ;<br>
                    }<br>
                    $var(i) = $var(i) + 1;<br>
                }<br>
<br>
                xlog("L_INFO","iPhone PUSH tokens for user $fU - remote: $var(pn-prid_remote), voip: $var(pn-prid_voip)");<br>
<br>
                # store the values of tokens to htable with fromUser as key<br>
                $sht(iphone_remote=>$fU) = $var(pn-prid_remote);<br>
                $sht(iphone_voip=>$fU) = $var(pn-prid_voip);<br>
                $sht(iphone_check=>$fU) = 1;<br>
<br>
                if ( $sht(vtp=>id_index::$tU) != $null ) {<br>
                    xlog("L_INFO", "New $rm ru=$ru tu=$tu \n");<br>
                    route(JOIN);<br>
                }<br>
            <br>
            } else {<br>
                # no iphone<br>
                $sht(iphone_check=>$fU) = 0;<br>
            }</font></p>
<p style="margin-top:0;margin-bottom:0"><font face="monospace">...</font></p>
<p style="margin-top:0;margin-bottom:0"><font face="monospace">...</font></p>
<p style="margin-top:0;margin-bottom:0"><font face="monospace">}</font><br>
</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"><font face="monospace">route[LOCATION] {</font></p>
<p style="margin-top:0;margin-bottom:0"><font face="monospace">...</font></p>
<p style="margin-top:0;margin-bottom:0"><font face="monospace">...</font></p>
<p style="margin-top:0;margin-bottom:0"><font face="monospace">        if (!lookup("location")) {<br>
            $var(rc) = $rc;<br>
                <br>
            # handle PUSH notifications for iPhone<br>
            # iphones should not be registered and contacts stored in database<br>
            # hence lookup should fail and we need to try to push iphone first<br>
            if ($sht(iphone_check=>$tU) == 1) {<br>
                xlog("L_ERR", "[PUSH] The to user has already used iPhone, trying push notifications");<br>
                xlog("L_ERR", "[PUSH] No registration to try, suspending.");<br>
                sl_send_reply("100", "Suspending");<br>
                route(SUSPEND);<br>
                route(RELAY);<br>
                exit;<br>
            }<br>
...</font></p>
<p style="margin-top:0;margin-bottom:0"><font face="monospace">...</font></p>
<p style="margin-top:0;margin-bottom:0"><font face="monospace">        if (is_method("INVITE")) {<br>
            setflag(FLT_ACCMISSED);<br>
            <br>
            # handle PUSH notifications for iPhone<br>
            # in some cases, iphone does not send de-register when going to background<br>
            # for these circumstances, push iphone even if it has an active registration<br>
            if ($sht(iphone_check=>$tU) == 1) {<br>
                xlog("L_ERR", "[PUSH] The to user has already used iPhone, trying push notifications");<br>
                xlog("L_ERR", "[PUSH] No registration to try, suspending.");<br>
                sl_send_reply("100", "Suspending");<br>
                route(SUSPEND);<br>
            }<br>
<br>
        }<br>
        route(RELAY);<br>
        exit;<br>
}<br>
</font><br>
</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"><font face="monospace">route[SUSPEND] {<br>
  if ( !t_suspend() ) {<br>
    xlog("L_ERROR","[SUSPEND]  failed suspending trasaction [$T(id_index):$T(id_label)]\n");<br>
    send_reply("501", "Suspending error");<br>
    exit;<br>
  } else {<br>
    xlog("L_INFO","[SUSPEND]  suspended transaction [$T(id_index):$T(id_label)] $fU=> $rU\n");<br>
    $sht(vtp=>id_index::$rU) = $T(id_index);<br>
    $sht(vtp=>id_label::$rU) = $T(id_label);<br>
    xlog("L_INFO","[SUSPEND] htable key value [$sht(vtp=>id_index::$rU)   --   $sht(vtp=>id_label::$rU)]\n");<br>
    route(SENDPUSH);<br>
    exit;<br>
  }<br>
}<br>
    <br>
route[SENDPUSH] {<br>
    #http_client_query(<a href="http://url/push.php" target="_blank" rel="noopener noreferrer" data-auth="NotApplicable" data-linkindex="0">"http://url/<span data-markjs="true" class="markyxfwfwj3j" data-ogac="" data-ogab="" data-ogsc="" data-ogsb="">push.php</span>"</a>,
 "user=$rU\r\npn-tok=$sht(tokens=>$rU)\r\n","Content-Type: text/plain", "$var(result)");<br>
    xlog("!!!!!!!!!!!!!!!!!!!!!! PUSH !!!!!!!!!!!!!!!!!!!");<br>
    xlog("/opt/push/push.sh $ci $sht(iphone_voip=>$tU)");<br>
    exec_avp("/opt/push/push.sh $ci $sht(iphone_voip=>$tU)");<br>
    xlog("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");<br>
    sl_send_reply("100", "Pushing");<br>
}<br>
<br>
route[JOIN] {<br>
    xlog("L_WARN","[JOIN] htable key value [$sht(vtp=>id_index::$tU)   --   $sht(vtp=>id_label::$tU)]\n");<br>
    t_continue("$sht(vtp=>id_index::$tU)", "$sht(vtp=>id_label::$tU)", "RESUME");<br>
    $sht(vtp=>joined::$tU) = 1;<br>
}<br>
    <br>
route[RESUME] {<br>
    lookup("location");<br>
    xlog("L_INFO","[RESUME] rm=$rm ru=$ru du=$du \n");<br>
    t_relay();<br>
    $sht(vtp=>id_index::$tU) = $null;<br>
    $sht(vtp=>id_label::$tU) = $null;<br>
    exit; }</font></p>
<br>
</div>
</blockquote>
</body>
</html>