Hi,

What happens in the route[RELAY]?

Maybe code after "route(RELAY)" is not executed?

When there is only 1 device what value is inside $var(hstored) when the register hits Kamailio?

Jurijs


On Wed, Jan 6, 2021 at 4:27 AM Jeremy McNamara <mcnamara.jeremy@gmail.com> wrote:
Hi Folks - I am attempting to set up a mobile push configuration, by following the published example(s).  

If we have more than one endpoint registered, this configuration works as expected (via the ts_store() path below).  

If we do not have another registered endpoint the transaction seems to be suspended but then cannot be resumed (t_suspend) after REGISTER arrives. 


INFO: <script>: [R-LOG]: INVITE from IP:[24.XXX.XXX.XXX:62665] [sip:jeremy2@stage][<null>]
NFO: <script>: [R-SUSPEND]: Suspended transaction [41359:415220139]
INFO: <script>: [R-SUSPEND]: fU:[jeremy] rU:[jeremy2] tU:[jeremy2]
INFO: <script>: [R-SUSPEND]: fU:[jeremy] => tU:[jeremy2]
INFO: <script>: [R-SUSPEND]: vtp:[41359:415220139]
INFO: <script>: [R-SENDPUSH]: Push sent [(55516cc061038f1283104abb39072a59107b7d8e13a1fd166b1704a315d07f78][com][hq01gt5utegi18ipkh1b]
[Node-Push]: About to push: 55516cc061038f1283104abb39072a59107b7d8e13a1fd166b1704a315d07f78
INFO: <script>: R-REGISTER]: jeremy2 registered
INFO: <script>: [R-REGISTER]: Contact: [<sip:ilyartjr@qjwhdafxlbtk.invalid;transport=ws>;expires=10;app-id=stage;pn-voip-tok=55516cc061038f1283104abb39072a59107b7d8e13a1fd166b1704a315d07f78]
INFO: <script>: [R-REGISTER]: App id: stage
INFO: <script>: [R-REGISTER]: Expires: 10
INFO: <script>: [R-JOIN]: jeremy2
INFO: <script>: [R-JOIN]: Resuming trasaction [41359:415220139] jeremy2 (41359:415220139)
WARNING: tm [t_suspend.c:197]: t_continue_helper(): transaction is not suspended [41359:415220139]
WARNING: tmx [tmx_mod.c:847]: w_t_continue(): resuming the processing of transaction [41359:415220139] failed


Relvant kamailio.cfg
[Note: I did notice we had to switch things up a bit if calls come from a PSTN number via SBC]


modparam("htable", "htable", "vtp=>size=10;autoexpire=300")

...
if (!lookup("location")) {
        send_reply("100", "Suspending");
        route(SUSPEND); // testing this path here
    } else {
        route(RELAY);
        ts_store("$tu");
        $sht(vtp=>stored::$tU) = 1;
       xlog("L_INFO", "[R-LOCATION]: Stored transaction      [$T(id_index):$T(id_label)] $fU => $tU\n");
    }      
...

route[SUSPEND] {
    if (!t_suspend()) {
        xlog("L_ERROR", "[R-SUSPEND]: Failed to suspend transaction [$T(id_index):$T(id_label)]\n");
        send_reply("501", "Unknown Destinaton");
        exit;
    }
    xlog("L_INFO", "[R-SUSPEND]: Suspended transaction [$T(id_index):$T(id_label)]\n");
    xlog("L_INFO", "[R-SUSPEND]: fU:[$fU] rU:[$rU] tU:[$tU]\n");
    if (isbflagset(FLB_PSTN)) {
       $sht(vtp=>join::$rU) = "" + $T(id_index) + ":" + $T(id_label);
       xlog("L_INFO", "[R-SUSPEND]: fU:[$fU] => rU:[$rU]\n");
       xlog("L_INFO", "[R-SUSPEND]: vtp:[$sht(vtp=>join::$rU)]\n");
    } else {
       $sht(vtp=>join::$tU) = "" + $T(id_index) + ":" + $T(id_label);
       xlog("L_INFO", "[R-SUSPEND]: fU:[$fU] => tU:[$tU]\n");
       xlog("L_INFO", "[R-SUSPEND]: vtp:[$sht(vtp=>join::$tU)]\n");
    }
}

route[REGISTER] {
   if (!is_method("REGISTER")) {
     return;
   }
   if (isflagset(FLT_NATS)) {
        setbflag(FLB_NATB);
   }
   if (!save("location")) {
      sl_reply_error();
   }
    route(JOIN);
}

# Append branches or resume the transaction
route[JOIN] {
    xlog("L_INFO","[R-JOIN]: $tU\n");
    $var(hjoin) = 0;
    lock("$tU");
    $var(hjoin) = $sht(vtp=>join::$tU);
    $var(hstored) = $sht(vtp=>stored::$tU);
    $sht(vtp=>join::$tU) = $null;
    unlock("$tU");
    if ($var(hjoin)==0) {
       if ($var(hstored)) {
          xlog("L_INFO","[R-JOIN]: Appending transaction ($tu)\n");  
          ts_append("location", "$tu");
          exit;
       }
       xlog("L_INFO","[R-JOIN]: No INVITE to resume\n");  
       exit;
    }
    $var(id_index) = $(var(hjoin){s.select,0,:}{s.int});
    $var(id_label) = $(var(hjoin){s.select,1,:}{s.int});
    xlog("L_INFO", "[R-JOIN]: Resuming trasaction [$var(id_index):$var(id_label)] $tU ($var(hjoin))\n");
    t_continue("$var(id_index)", "$var(id_label)", "RESUME");
    exit;
}

# Lookup and relay after resuming transaction
route[RESUME] {
    xlog("L_INFO", "[R-RESUME]: ru: [$ru] tu: [$tu]\n");
    lookup("location");
    route(SETUP_ROUTES);
    route(RELAY);
    ts_store("$tu");
    $sht(vtp=>stored::$tU) = 1;
    xlog("L_INFO", "[R-RESUME]: Stored transaction [$T(id_index):$T(id_label)] $fU => $tU\n");
    exit;
}


What did I miss? 




_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users