<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1252">
  </head>
  <body>
    <p>Hello,</p>
    <p>I suggest to run kamailio with debug=3 in kamailio.cfg to see if
      the ringing state is published by dialog/pua_dialoginfo during the
      call setup.</p>
    <p>On the other hand, the dialoginfo is a different event than
      user/device presence state, so the endpoints have to subscribe for
      both dialog info and presence states to get notifications on both
      cases. Eventually you can enhance the config (or code) to generate
      presence states on dialog-info events -- iirc, with pua (or
      pua_json), you can push any PUBLISH (or presence states).</p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <div class="moz-cite-prefix">On 11.06.20 18:43, Pover A.V. wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:LOYP265MB1872F066020670897ADF7ECAF3800@LOYP265MB1872.GBRP265.PROD.OUTLOOK.COM">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
p.1qeiagb0cpwnlhdf9xsijm, li.1qeiagb0cpwnlhdf9xsijm, div.1qeiagb0cpwnlhdf9xsijm
        {mso-style-name:_1qeiagb0cpwnlhdf9xsijm;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="1qeiagb0cpwnlhdf9xsijm"
style="margin:0cm;margin-bottom:.0001pt;background:white;vertical-align:baseline"><span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#1A1A1B">Summary:
            Using Kamailio to load balance between Asterisk servers.
            Trouble getting call queuing working because can’t get
            device state hints to work reliably.<o:p></o:p></span></p>
        <p class="1qeiagb0cpwnlhdf9xsijm"
style="margin:0cm;margin-bottom:.0001pt;background:white;vertical-align:baseline;font-variant-ligatures:
          normal;font-variant-caps: normal;font-variant-numeric:
          inherit;font-variant-east-asian: inherit;font-stretch:
          inherit;line-height:inherit;orphans:
          2;text-align:start;widows: 2;-webkit-text-stroke-width:
          0px;text-decoration-style: initial;text-decoration-color:
          initial;word-spacing:0px">
          <span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#1A1A1B">—<o:p></o:p></span></p>
        <p class="1qeiagb0cpwnlhdf9xsijm"
style="margin:0cm;margin-bottom:.0001pt;background:white;vertical-align:baseline;font-variant-ligatures:
          normal;font-variant-caps: normal;font-variant-numeric:
          inherit;font-variant-east-asian: inherit;font-stretch:
          inherit;line-height:inherit;orphans:
          2;text-align:start;widows: 2;-webkit-text-stroke-width:
          0px;text-decoration-style: initial;text-decoration-color:
          initial;word-spacing:0px">
          <span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#1A1A1B">Hello<o:p></o:p></span></p>
        <p class="1qeiagb0cpwnlhdf9xsijm"
style="margin:0cm;margin-bottom:.0001pt;background:white;vertical-align:baseline"><span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#1A1A1B"><o:p> </o:p></span></p>
        <p class="1qeiagb0cpwnlhdf9xsijm"
style="margin:0cm;margin-bottom:.0001pt;background:white;vertical-align:baseline;font-variant-ligatures:
          normal;font-variant-caps: normal;font-variant-numeric:
          inherit;font-variant-east-asian: inherit;font-stretch:
          inherit;line-height:inherit;orphans:
          2;text-align:start;widows: 2;-webkit-text-stroke-width:
          0px;text-decoration-style: initial;text-decoration-color:
          initial;word-spacing:0px">
          <span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#1A1A1B">I’d
            be grateful for any advice that can be offered for this
            problem to do with presence and call queueing.<o:p></o:p></span></p>
        <p class="1qeiagb0cpwnlhdf9xsijm"
style="margin:0cm;margin-bottom:.0001pt;background:white;vertical-align:baseline"><span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#1A1A1B"><o:p> </o:p></span></p>
        <p class="1qeiagb0cpwnlhdf9xsijm"
style="margin:0cm;margin-bottom:.0001pt;background:white;vertical-align:baseline;font-variant-ligatures:
          normal;font-variant-caps: normal;font-variant-numeric:
          inherit;font-variant-east-asian: inherit;font-stretch:
          inherit;line-height:inherit;orphans:
          2;text-align:start;widows: 2;-webkit-text-stroke-width:
          0px;text-decoration-style: initial;text-decoration-color:
          initial;word-spacing:0px">
          <span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#1A1A1B">I
            have 3 Kamailio (v5.3.4) servers that load-balance incoming
            traffic from various sources: a legacy PBX, soft phone
            clients, and a SIP trunking service.<o:p></o:p></span></p>
        <p class="1qeiagb0cpwnlhdf9xsijm"
style="margin:0cm;margin-bottom:.0001pt;background:white;vertical-align:baseline"><span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#1A1A1B"><o:p> </o:p></span></p>
        <p class="1qeiagb0cpwnlhdf9xsijm"
style="margin:0cm;margin-bottom:.0001pt;background:white;vertical-align:baseline;font-variant-ligatures:
          normal;font-variant-caps: normal;font-variant-numeric:
          inherit;font-variant-east-asian: inherit;font-stretch:
          inherit;line-height:inherit;orphans:
          2;text-align:start;widows: 2;-webkit-text-stroke-width:
          0px;text-decoration-style: initial;text-decoration-color:
          initial;word-spacing:0px">
          <span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#1A1A1B">Sitting
            behind the 3 Kamailio servers are 2 Asterisk (v16 LTS)
            servers.<o:p></o:p></span></p>
        <p class="1qeiagb0cpwnlhdf9xsijm"
style="margin:0cm;margin-bottom:.0001pt;background:white;vertical-align:baseline"><span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#1A1A1B"><o:p> </o:p></span></p>
        <p class="1qeiagb0cpwnlhdf9xsijm"
style="margin:0cm;margin-bottom:.0001pt;background:white;vertical-align:baseline;font-variant-ligatures:
          normal;font-variant-caps: normal;font-variant-numeric:
          inherit;font-variant-east-asian: inherit;font-stretch:
          inherit;line-height:inherit;orphans:
          2;text-align:start;widows: 2;-webkit-text-stroke-width:
          0px;text-decoration-style: initial;text-decoration-color:
          initial;word-spacing:0px">
          <span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#1A1A1B">Kamailio
            acts as a registrar and user location service. Asterisk is
            routing calls and (should be) providing device state
            information for each extension.<o:p></o:p></span></p>
        <p class="1qeiagb0cpwnlhdf9xsijm"
style="margin:0cm;margin-bottom:.0001pt;background:white;vertical-align:baseline"><span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#1A1A1B"><o:p> </o:p></span></p>
        <p class="1qeiagb0cpwnlhdf9xsijm"
style="margin:0cm;margin-bottom:.0001pt;background:white;vertical-align:baseline;font-variant-ligatures:
          normal;font-variant-caps: normal;font-variant-numeric:
          inherit;font-variant-east-asian: inherit;font-stretch:
          inherit;line-height:inherit;orphans:
          2;text-align:start;widows: 2;-webkit-text-stroke-width:
          0px;text-decoration-style: initial;text-decoration-color:
          initial;word-spacing:0px">
          <span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#1A1A1B">An
            external script builds a list of PJSIP endpoints based on
            the content of the Kamailio subscriber table, and deploys it
            to the Asterisk servers whenever a change is detected. The
            AOR for each record is configured to point to Kamailio. No
            authentication details are attached to these endpoints, as
            Kamailio is doing authentication before dispatching a
            request to Asterisk.<o:p></o:p></span></p>
        <p class="1qeiagb0cpwnlhdf9xsijm"
style="margin:0cm;margin-bottom:.0001pt;background:white;vertical-align:baseline"><span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#1A1A1B"><o:p> </o:p></span></p>
        <p class="1qeiagb0cpwnlhdf9xsijm"
style="margin:0cm;margin-bottom:.0001pt;background:white;vertical-align:baseline;font-variant-ligatures:
          normal;font-variant-caps: normal;font-variant-numeric:
          inherit;font-variant-east-asian: inherit;font-stretch:
          inherit;line-height:inherit;orphans:
          2;text-align:start;widows: 2;-webkit-text-stroke-width:
          0px;text-decoration-style: initial;text-decoration-color:
          initial;word-spacing:0px">
          <span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#1A1A1B">Whenever
            Kamailio receives an INVITE, it passes this to an Asterisk
            server using the dispatcher module (round-robin algorithm
            ‘4’); asterisk then processes the request.<o:p></o:p></span></p>
        <p class="1qeiagb0cpwnlhdf9xsijm"
style="margin:0cm;margin-bottom:.0001pt;background:white;vertical-align:baseline"><span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#1A1A1B"><o:p> </o:p></span></p>
        <p class="1qeiagb0cpwnlhdf9xsijm"
style="margin:0cm;margin-bottom:.0001pt;background:white;vertical-align:baseline;font-variant-ligatures:
          normal;font-variant-caps: normal;font-variant-numeric:
          inherit;font-variant-east-asian: inherit;font-stretch:
          inherit;line-height:inherit;orphans:
          2;text-align:start;widows: 2;-webkit-text-stroke-width:
          0px;text-decoration-style: initial;text-decoration-color:
          initial;word-spacing:0px">
          <span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#1A1A1B">At
            the moment, everything is working except for presence/device
            states and call queueing.<o:p></o:p></span></p>
        <p class="1qeiagb0cpwnlhdf9xsijm"
style="margin:0cm;margin-bottom:.0001pt;background:white;vertical-align:baseline"><span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#1A1A1B"><o:p> </o:p></span></p>
        <p class="1qeiagb0cpwnlhdf9xsijm"
style="margin:0cm;margin-bottom:.0001pt;background:white;vertical-align:baseline;font-variant-ligatures:
          normal;font-variant-caps: normal;font-variant-numeric:
          inherit;font-variant-east-asian: inherit;font-stretch:
          inherit;line-height:inherit;orphans:
          2;text-align:start;widows: 2;-webkit-text-stroke-width:
          0px;text-decoration-style: initial;text-decoration-color:
          initial;word-spacing:0px">
          <span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#1A1A1B">I’ve
            tried to set up ‘presence’, ‘pua’, ‘dialog’ and
            ‘(presence/pua)_dialoginfo’ modules on Kamailio with limited
            success. The presence state when a user toggles ‘do not
            disturb’ on their soft phone is passed to other users who
            are subscribed (watching), however when a user makes a call,
            no presence updates are seen by subscribed users (the
            extensions show as ‘Idle’ or ‘Available’ instead of ‘In Use’
            or ‘Busy’).<o:p></o:p></span></p>
        <p class="1qeiagb0cpwnlhdf9xsijm"
style="margin:0cm;margin-bottom:.0001pt;background:white;vertical-align:baseline"><span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#1A1A1B"><o:p> </o:p></span></p>
        <p class="1qeiagb0cpwnlhdf9xsijm"
style="margin:0cm;margin-bottom:.0001pt;background:white;vertical-align:baseline;font-variant-ligatures:
          normal;font-variant-caps: normal;font-variant-numeric:
          inherit;font-variant-east-asian: inherit;font-stretch:
          inherit;line-height:inherit;orphans:
          2;text-align:start;widows: 2;-webkit-text-stroke-width:
          0px;text-decoration-style: initial;text-decoration-color:
          initial;word-spacing:0px">
          <span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#1A1A1B">Asterisk
            is able to report that an extension is ‘Ringing’ or ‘InUse’
            when a call is made to that extension, because an INVITE to
            an internal extension matches a pattern in the dialplan and
            Asterisk routes it to a PJSIP endpoint with the same name.
            However, when somebody makes a call, Asterisk is unable to
            track the state of the extension making the call because the
            call is going via Kamailio so Asterisk is not seeing the
            caller as an internal extension. We need a way to make
            Asterisk think the call is coming from an internal device if
            the caller ID matches a PJSIP endpoint.<o:p></o:p></span></p>
        <p class="1qeiagb0cpwnlhdf9xsijm"
style="margin:0cm;margin-bottom:.0001pt;background:white;vertical-align:baseline"><span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#1A1A1B"><o:p> </o:p></span></p>
        <p class="1qeiagb0cpwnlhdf9xsijm"
style="margin:0cm;margin-bottom:.0001pt;background:white;vertical-align:baseline;font-variant-ligatures:
          normal;font-variant-caps: normal;font-variant-numeric:
          inherit;font-variant-east-asian: inherit;font-stretch:
          inherit;line-height:inherit;orphans:
          2;text-align:start;widows: 2;-webkit-text-stroke-width:
          0px;text-decoration-style: initial;text-decoration-color:
          initial;word-spacing:0px">
          <span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#1A1A1B">Both
            Asterisk servers are configured to share device state
            updates with each other, and this is working.<o:p></o:p></span></p>
        <p class="1qeiagb0cpwnlhdf9xsijm"
style="margin:0cm;margin-bottom:.0001pt;background:white;vertical-align:baseline"><span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#1A1A1B"><o:p> </o:p></span></p>
        <p class="1qeiagb0cpwnlhdf9xsijm"
style="margin:0cm;margin-bottom:.0001pt;background:white;vertical-align:baseline;font-variant-ligatures:
          normal;font-variant-caps: normal;font-variant-numeric:
          inherit;font-variant-east-asian: inherit;font-stretch:
          inherit;line-height:inherit;orphans:
          2;text-align:start;widows: 2;-webkit-text-stroke-width:
          0px;text-decoration-style: initial;text-decoration-color:
          initial;word-spacing:0px">
          <span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#1A1A1B">Without
            being able to see device state for an internal calling
            party, we will be unable to reliably set up call queues in
            Asterisk.<o:p></o:p></span></p>
        <p class="1qeiagb0cpwnlhdf9xsijm"
style="margin:0cm;margin-bottom:.0001pt;background:white;vertical-align:baseline"><span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#1A1A1B"><o:p> </o:p></span></p>
        <p class="1qeiagb0cpwnlhdf9xsijm"
style="margin:0cm;margin-bottom:.0001pt;background:white;vertical-align:baseline;font-variant-ligatures:
          normal;font-variant-caps: normal;font-variant-numeric:
          inherit;font-variant-east-asian: inherit;font-stretch:
          inherit;line-height:inherit;orphans:
          2;text-align:start;widows: 2;-webkit-text-stroke-width:
          0px;text-decoration-style: initial;text-decoration-color:
          initial;word-spacing:0px">
          <span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#1A1A1B">Using
            the ‘mohqueue’ module on Kamailio is not something we want
            to do because of its reliance on a database, which is
            creating a single point of failure – if the database server
            is down for any reason, Kamailio refuses to start.<o:p></o:p></span></p>
        <p class="1qeiagb0cpwnlhdf9xsijm"
style="margin:0cm;margin-bottom:.0001pt;background:white;vertical-align:baseline"><span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#1A1A1B"><o:p> </o:p></span></p>
        <p class="1qeiagb0cpwnlhdf9xsijm"
style="margin:0cm;margin-bottom:.0001pt;background:white;vertical-align:baseline;font-variant-ligatures:
          normal;font-variant-caps: normal;font-variant-numeric:
          inherit;font-variant-east-asian: inherit;font-stretch:
          inherit;line-height:inherit;orphans:
          2;text-align:start;widows: 2;-webkit-text-stroke-width:
          0px;text-decoration-style: initial;text-decoration-color:
          initial;word-spacing:0px">
          <span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#1A1A1B">Ideally,
            we would achieve some form of distributed call queueing,
            however the simplest option seems to be setting up a queue
            on one Asterisk server and having an active-passive high
            availability configuration, should a server go down.<o:p></o:p></span></p>
        <p class="1qeiagb0cpwnlhdf9xsijm"
style="margin:0cm;margin-bottom:.0001pt;background:white;vertical-align:baseline"><span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#1A1A1B"><o:p> </o:p></span></p>
        <p class="1qeiagb0cpwnlhdf9xsijm"
style="margin:0cm;margin-bottom:.0001pt;background:white;vertical-align:baseline;font-variant-ligatures:
          normal;font-variant-caps: normal;font-variant-numeric:
          inherit;font-variant-east-asian: inherit;font-stretch:
          inherit;line-height:inherit;orphans:
          2;text-align:start;widows: 2;-webkit-text-stroke-width:
          0px;text-decoration-style: initial;text-decoration-color:
          initial;word-spacing:0px">
          <span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#1A1A1B">I’m
            looking for advice on how best to keep track of what is
            happening in a call, and for Asterisk to know the states of
            each extension and make these available in a dialplan hint.
            Or any other suggestions that might help to achieve call
            queueing in this setup.<o:p></o:p></span></p>
        <p class="1qeiagb0cpwnlhdf9xsijm"
style="margin:0cm;margin-bottom:.0001pt;background:white;vertical-align:baseline;font-variant-ligatures:
          normal;font-variant-caps: normal;font-variant-numeric:
          inherit;font-variant-east-asian: inherit;font-stretch:
          inherit;line-height:inherit;orphans:
          2;text-align:start;widows: 2;-webkit-text-stroke-width:
          0px;text-decoration-style: initial;text-decoration-color:
          initial;word-spacing:0px">
          <span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#1A1A1B"><o:p> </o:p></span></p>
        <p class="1qeiagb0cpwnlhdf9xsijm"
style="margin:0cm;margin-bottom:.0001pt;background:white;vertical-align:baseline"><span
style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#1A1A1B">Thank
            you<o:p></o:p></span></p>
        <p class="MsoNormal"><o:p> </o:p></p>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
Kamailio (SER) - Users Mailing List
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a>
<a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Funding: <a class="moz-txt-link-freetext" href="https://www.paypal.me/dcmierla">https://www.paypal.me/dcmierla</a></pre>
  </body>
</html>