<div dir="ltr">Daniel,<div><br></div><div>   In short kamcmd does not reflect the value set in <span style="color:rgb(180,36,25);font-family:Menlo;font-size:11px;font-variant-ligatures:no-common-ligatures">$<span id="gmail-m_2691004320480208920:ka.51">sht</span>(server=</span><span style="color:rgb(180,36,25);font-family:Menlo;font-size:11px;font-variant-ligatures:no-common-ligatures">><span id="gmail-m_2691004320480208920:ka.52">auth</span>::token)</span></div><div><span style="color:rgb(180,36,25);font-family:Menlo;font-size:11px;font-variant-ligatures:no-common-ligatures"><br></span></div>It alternates between being set and not being set (reflecting in kamcmd htable.dump<div><br></div><div>





<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">root@main:/etc/kamailio# kamcmd htable.dump server</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">{</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-tab-span" style="white-space:pre">  </span>entry: 11</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-tab-span" style="white-space:pre">  </span>size: 1</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-tab-span" style="white-space:pre">  </span>slot: {</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-tab-span" style="white-space:pre">  </span><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>{</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-tab-span" style="white-space:pre">  </span><span class="gmail-Apple-tab-span" style="white-space:pre">      </span><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>name: auth::token</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-tab-span" style="white-space:pre">  </span><span class="gmail-Apple-tab-span" style="white-space:pre">      </span><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>value: {"data":{"token":{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJDUllZIiwiaWF0IjoxNjA0MzQ2NzgzLCJleHAiOjE2MDQzNTAzODMsIm1ldGhvZCI6InBvc3Q6YXV0aDp0b2tlbiIsImFjY291bnQiOnsiaWQiOiIxIiwiZmlyc3RuYW1lIjoiVGVzdCIsImxhc3RuYW1lIjoiQXJtc3RlYWQiLCJlbWFpbCI6ImJyYW5kb25AY3J5eS5jb20ifSwic291cmNlIjp7ImFkZHJlc3MiOiIzNC45NC4xMjMuMTIxIn19.aFGWqQg31oNnw10XfZ61Xm5Jncvt7RoNri2ZuDJ6yLQ","header":{"alg":"HS256","typ":"JWT"},"payload":{"iss":"CRYY","iat":1604346783,"exp":1604350383,"method":"post:auth:token","account":{"id":"1","firstname":"Test","lastname":"Armstead","email":"<a href="mailto:brandon@cryy.com">brandon@cryy.com</a>"},"source":{"address":"34.94.123.121"}},"signature":"aFGWqQg31oNnw10XfZ61Xm5Jncvt7RoNri2ZuDJ6yLQ"}}}</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-tab-span" style="white-space:pre">  </span><span class="gmail-Apple-tab-span" style="white-space:pre">      </span><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>type: str</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-tab-span" style="white-space:pre">  </span><span class="gmail-Apple-tab-span" style="white-space:pre">      </span>}</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-tab-span" style="white-space:pre">  </span>}</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">}</span></p><p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures"><br></span></p>In the kamailio logs it always shows AUTH_TOKEN_RECEIVED (correctly, with the correct auth token), kamcmd dump of htable alternates between execution of this route: <span id="gmail-m_2691004320480208920:ka.59" style="font-variant-ligatures:no-common-ligatures;color:rgb(47,180,29);font-family:Menlo;font-size:11px">htable</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(47,180,29);font-family:Menlo;font-size:11px">:expired:</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(47,180,29);font-family:Menlo;font-size:11px">server</span></div><div><span style="font-variant-ligatures:no-common-ligatures;color:rgb(47,180,29);font-family:Menlo;font-size:11px"><br></span></div><div>Exec 1:</div><div><br></div><div>auth::time => [timestamp]</div><div><br></div><div>Exec 2:</div><div><br></div><div>auth::token => token</div><div><br></div><div>Exec 3:</div><div><br></div><div>auth::time => [timestamp]</div><div><br></div><div>So on and so forth, [ kamcmd htable.dump server ] it does not correctly hold both $sht(server=>auth::time) and  $sht(server=>auth::token) like it should, despite kamailio logs showing the HTTP_AUTH_TOKEN received message with the correct auth token (100% of the time).</div><div><br></div>It's almost like there is a race condition when using the modules http_client_query in both init and expired event route.<div><br></div><div>When I changed it to the resolved code block above separating the calls and introducing http_async_client inside <span id="gmail-m_4201803001951547713:142.30" style="color:rgb(47,180,29);font-family:Menlo;font-size:11px;font-variant-ligatures:no-common-ligatures">htable</span><span style="color:rgb(47,180,29);font-family:Menlo;font-size:11px;font-variant-ligatures:no-common-ligatures">:expired:</span><span style="color:rgb(47,180,29);font-family:Menlo;font-size:11px;font-variant-ligatures:no-common-ligatures">server</span></div><div><span style="color:rgb(47,180,29);font-family:Menlo;font-size:11px;font-variant-ligatures:no-common-ligatures"><br></span></div>The result is 100% of the time auth token exists correctly, just like the logs 100% of the time show the auth token received regardless of event_route implementation.<div><br></div><div>So somewhere somehow the problematic config causes the hash table to not store HTTP_AUTH_TOKEN it receives and logs.</div></div>