<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<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);">
Thanks Henning,</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);">
There are many voip application now that uses kamailio server on both app store/google play.</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);">
From my experience, i would recommend:</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);">
Android:  Baresip & Baresip video  (with ZRTP <span id="🙂">🙂</span>)</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Iphone: Linphone  or Acrobits (paid)</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
PC Windows Computer: i love <a href="http://tomeko.net/software/SIPclient/" id="LPlnk">http://tomeko.net/software/SIPclient/</a><br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
(easy and stable)</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Centos/Debian:  Linphone appimage (linux)</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 think Kamailio must add internally push notification feature, this will increase the attraction of the kamailio platform to many many mobile coders in the world.</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);">
Adding the ios push notification fix, seems very complicate and few people could do it, i added a code snippet of a kamailio.cfg file that works (it uses a push.php)
<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);">
What i see recently is integration of gateways on mobile voips, such as telegram. You could a telegram number and it is routed to a sip server.</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);">
Javier<br>
</div>
<div class="_Entity _EType_OWALinkPreview _EId_OWALinkPreview _EReadonly_1"></div>
<br>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>De:</b> Henning Westerholt <hw@skalatan.de><br>
<b>Enviado:</b> martes, 29 de junio de 2021 11:04<br>
<b>Para:</b> Kamailio (SER) - Development Mailing List <sr-dev@lists.kamailio.org><br>
<b>Cc:</b> javier falbo <javier_falbo@hotmail.com><br>
<b>Asunto:</b> RE: Implementation of ios/android push notifications module or similar</font>
<div> </div>
</div>
<style>
<!--
@font-face
        {font-family:"Cambria Math"}
@font-face
        {font-family:Calibri}
p.x_MsoNormal, li.x_MsoNormal, div.x_MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif}
a:link, span.x_MsoHyperlink
        {color:blue;
        text-decoration:underline}
span.x_markyxfwfwj3j
        {}
span.x_E-MailFormatvorlage20
        {font-family:"Calibri",sans-serif;
        color:windowtext}
.x_MsoChpDefault
        {font-size:10.0pt}
@page WordSection1
        {margin:70.85pt 70.85pt 2.0cm 70.85pt}
div.x_WordSection1
        {}
-->
</style>
<div lang="DE" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="x_WordSection1">
<p class="x_MsoNormal"><span lang="EN-GB" style="">Hi Javier,</span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style=""> </span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style="">can you list a few app names, this would be great.
</span><span lang="EN-GB" style="font-family:"Segoe UI Emoji",sans-serif">😊</span><span lang="EN-GB" style=""></span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style=""> </span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style="">Regarding inclusion of this logic in the default cfg – we usually try to keep the default cfg to cover the basic use cases for VoIP infrastructure. I am not sure if push notifications are already there yet,
 but other people on this list might have another opinion.</span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style=""> </span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style="">What definitely could be done is to add a dedicated example configuration in the misc/examples directory. If you are interested in contributing something, just create a pull request for it.</span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style=""> </span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style="">Cheers,</span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style=""> </span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style="">Henning</span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style=""> </span></p>
<div>
<div style="border:none; border-top:solid #E1E1E1 1.0pt; padding:3.0pt 0cm 0cm 0cm">
<p class="x_MsoNormal" style="margin-left:35.4pt"><b>From:</b> sr-dev <sr-dev-bounces@lists.kamailio.org>
<b>On Behalf Of </b>javier falbo<br>
<b>Sent:</b> Tuesday, June 29, 2021 3:56 PM<br>
<b>To:</b> sr-dev@lists.kamailio.org<br>
<b>Subject:</b> [sr-dev] Implementation of ios/android push notifications module or similar</p>
</div>
</div>
<p class="x_MsoNormal" style="margin-left:35.4pt"> </p>
<div>
<p class="x_MsoNormal" style="margin-left:35.4pt"><span style="font-size:12.0pt; color:black">Hello,</span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:35.4pt"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:35.4pt"><span style="font-size:12.0pt; color:black">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. </span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:35.4pt"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:35.4pt"><span style="font-size:12.0pt; color:black">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.</span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:35.4pt"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:35.4pt"><span style="font-size:12.0pt; color:black">Navigating on the web, i found some uncomplete or minimum tutorials to implement this.
</span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:35.4pt"><span style="font-size:12.0pt; color:black">Like:
<a href="https://denys-pozniak.medium.com/apple-push-notification-with-kamailio-eeca2f8e08d">
https://denys-pozniak.medium.com/apple-push-notification-with-kamailio-eeca2f8e08d</a></span></p>
</div>
<p class="x_MsoNormal" style="margin-left:35.4pt"> </p>
<div>
<p class="x_MsoNormal" style="margin-left:35.4pt"><span style="font-size:12.0pt; color:black">And also some code snippets of a modification of "kamailio.cfg" to add support for ios push notifications. (see below).</span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:35.4pt"><span style="font-size:12.0pt; color:black">Could someone have this already working? Or kamailio official developers could add this by default inside source code?</span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:35.4pt"><span style="font-size:12.0pt; color:black"> </span></p>
</div>
<blockquote style="border:none #C8C8C8 1.0pt; border-left:solid #C8C8C8 2.25pt; padding:0cm 0cm 0cm 6.0pt; margin-left:4.8pt; margin-top:5.0pt; margin-bottom:5.0pt">
<div>
<p style="margin-right:0cm; margin-bottom:12.0pt; margin-left:35.4pt"><span style="font-family:"Courier New"; color:#666666"># 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;")</span><span style="color:#666666"></span></p>
<p style="margin-left:35.4pt"><span style="color:#666666"> </span></p>
<p style="margin-left:35.4pt"><span style="font-family:"Courier New"; color:#666666">route[REGISTRAR] {</span><span style="color:#666666"></span></p>
<p style="margin-left:35.4pt"><span style="font-family:"Courier New"; color:#666666">...</span><span style="color:#666666"></span></p>
<p style="margin-left:35.4pt"><span style="font-family:"Courier New"; color:#666666">...</span><span style="color:#666666"></span></p>
<p style="margin-left:35.4pt"><span style="font-family:"Courier New"; color:#666666">        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>
            }</span><span style="color:#666666"></span></p>
<p style="margin-left:35.4pt"><span style="font-family:"Courier New"; color:#666666">...</span><span style="color:#666666"></span></p>
<p style="margin-left:35.4pt"><span style="font-family:"Courier New"; color:#666666">...</span><span style="color:#666666"></span></p>
<p style="margin-left:35.4pt"><span style="font-family:"Courier New"; color:#666666">}</span><span style="color:#666666"></span></p>
<p style="margin-left:35.4pt"><span style="color:#666666"> </span></p>
<p style="margin-left:35.4pt"><span style="color:#666666"> </span></p>
<p style="margin-left:35.4pt"><span style="font-family:"Courier New"; color:#666666">route[LOCATION] {</span><span style="color:#666666"></span></p>
<p style="margin-left:35.4pt"><span style="font-family:"Courier New"; color:#666666">...</span><span style="color:#666666"></span></p>
<p style="margin-left:35.4pt"><span style="font-family:"Courier New"; color:#666666">...</span><span style="color:#666666"></span></p>
<p style="margin-left:35.4pt"><span style="font-family:"Courier New"; color:#666666">        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>
...</span><span style="color:#666666"></span></p>
<p style="margin-left:35.4pt"><span style="font-family:"Courier New"; color:#666666">...</span><span style="color:#666666"></span></p>
<p style="margin-right:0cm; margin-bottom:12.0pt; margin-left:35.4pt"><span style="font-family:"Courier New"; color:#666666">        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>
}</span><span style="color:#666666"></span></p>
<p style="margin-left:35.4pt"><span style="color:#666666"> </span></p>
<p style="margin-left:35.4pt"><span style="color:#666666"> </span></p>
<p style="margin-left:35.4pt"><span style="font-family:"Courier New"; color:#666666">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">"http://url/<span class="x_markyxfwfwj3j">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; }</span><span style="color:#666666"></span></p>
<p class="x_MsoNormal" style="margin-left:35.4pt"><span style="color:#666666"> </span></p>
</div>
</blockquote>
</div>
</div>
</body>
</html>