<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1250">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <tt>Hi, Jonathan!<br>
      <br>
      Your alternative works too. If you want to use the previous
      version, you can use the + operator to concatenet strings:<br>
      <br>
      $avp(test) = "<?xml... entity=\"" + $avp(test) + "\"> ...";<br>
      <br>
      Best regards,<br>
    </tt>
    <pre class="moz-signature" cols="72">Răzvan Crainea
OpenSIPS Developer
<a class="moz-txt-link-abbreviated" href="http://www.opensips-solutions.com">www.opensips-solutions.com</a></pre>
    <div class="moz-cite-prefix">On 10/11/2017 11:36 PM, Jonathan Hunter
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:DB4PR02MB03360C7B52A6467B62CE7654BD4A0@DB4PR02MB0336.eurprd02.prod.outlook.com">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1250">
      <style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
      <div id="divtagdefaultwrapper"
style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;"
        dir="ltr">
        <p>Sorry guys, spam will stop now!</p>
        <p><br>
        </p>
        <p>Found an alternative method which works;</p>
        <p><br>
        </p>
        <p><span>search_append_body("</tuple>", " <note
            xmlns=\"urn:ietf:params:xml:ns:pidf\"> available
            </note><dm:person
            xmlns:dm=\"urn:ietf:params:xml:ns:pidf:data-model\"
            xmlns:rpid=\"urn:ietf:params:xml:ns:pidf:rpid\"
            id=\"pers_mixingid\"> <dm:note> available
            </dm:note> </dm:person>");</span><br>
        </p>
        <p><span><br>
          </span></p>
        <p><span>Thanks!</span></p>
        <p><span><br>
          </span></p>
        <p><span>Jon</span></p>
        <br>
        <br>
        <div style="color: rgb(0, 0, 0);">
          <hr tabindex="-1" style="display:inline-block; width:98%">
          <div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt"
              face="Calibri, sans-serif" color="#000000"><b>From:</b>
              Jonathan Hunter <a class="moz-txt-link-rfc2396E" href="mailto:hunterj91@hotmail.com"><hunterj91@hotmail.com></a><br>
              <b>Sent:</b> 11 October 2017 19:34<br>
              <b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:users@lists.opensips.org">users@lists.opensips.org</a><br>
              <b>Subject:</b> Re: [OpenSIPS-Users] opensips 2.2 generate
              NOTIFY with status=available</font>
            <div> </div>
          </div>
          <div>
            <div id="divtagdefaultwrapper" dir="ltr"
              style="font-size:12pt; color:#000000;
              font-family:Calibri,Helvetica,sans-serif">
              <div>Hi Guys,</div>
              <div><br>
              </div>
              <div>Almost have this working, where I replace a NOTIFY
                message and then send it on for presence.</div>
              <div><br>
              </div>
              <div>The remaining issue is populating the entity value
                using an AVP as below, it just adds it as
                entity="$avp(test)" and not the value of it.</div>
              <div><br>
              </div>
              <div><br>
              </div>
              <div>$avp(test) = "sip:" + $fU + "@" + $fd;</div>
              <div><br>
              </div>
              <div>$avp(newbody) = "<?xml version=\"1.0\" ?>
                <presence xmlns=\"urn:ietf:params:xml:ns:pidf\"
                <b>entity=\"$avp(test)\"> </b><tuple
                xmlns=\"urn:ietf:params:xml:ns:pidf\"
                id=\"tuple_mixingid\"> <status> <basic>
                open </basic> </status> </tuple>
                <note xmlns=\"urn:ietf:params:xml:ns:pidf\">
                available </note><dm:person
                xmlns:dm=\"urn:ietf:params:xml:ns:pidf:data-model\"
                xmlns:rpid=\"urn:ietf:params:xml:ns:pidf:rpid\"
                id=\"pers_mixingid\"> <dm:note> available
                </dm:note> </dm:person> </presence>";</div>
              <div>add_body("$avp(newbody)");</div>
              <div><br>
              </div>
              <div><br>
              </div>
              <div>Can anyone advise as to how I can escape the
                $avp(test) so its value is populated?</div>
              <div><br>
              </div>
              <div>Thanks!</div>
              <div><br>
              </div>
              <div>Jon</div>
              <br>
              <br>
              <br>
              <div style="color:rgb(0,0,0)">
                <hr tabindex="-1" style="display:inline-block;
                  width:98%">
                <div id="divRplyFwdMsg" dir="ltr"><font
                    style="font-size:11pt" face="Calibri, sans-serif"
                    color="#000000"><b>From:</b> Jonathan Hunter
                    <a class="moz-txt-link-rfc2396E" href="mailto:hunterj91@hotmail.com"><hunterj91@hotmail.com></a><br>
                    <b>Sent:</b> 10 October 2017 20:20<br>
                    <b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:users@lists.opensips.org">users@lists.opensips.org</a><br>
                    <b>Subject:</b> Re: [OpenSIPS-Users] opensips 2.2
                    generate NOTIFY with status=available</font>
                  <div> </div>
                </div>
                <div>
                  <div id="divtagdefaultwrapper" dir="ltr"
                    style="font-size:12pt; color:#000000;
                    font-family:Calibri,Helvetica,sans-serif">
                    <p><span
                        style="font-family:Calibri,Helvetica,sans-serif;
                        font-size:16px">Hi Răzvan,</span></p>
                    <p><span
                        style="font-family:Calibri,Helvetica,sans-serif;
                        font-size:16px"><br>
                      </span></p>
                    <p><span
                        style="font-family:Calibri,Helvetica,sans-serif;
                        font-size:16px">Sorry another follow up
                        question.</span></p>
                    <p><span
                        style="font-family:Calibri,Helvetica,sans-serif;
                        font-size:16px"><br>
                      </span></p>
                    <p><span
                        style="font-family:Calibri,Helvetica,sans-serif;
                        font-size:16px">Say I want to remove the body of
                        the NOTIFY and add the below;</span></p>
                    <p><span
                        style="font-family:Calibri,Helvetica,sans-serif;
                        font-size:16px"><br>
                      </span></p>
                    <p><span
                        style="font-family:Calibri,Helvetica,sans-serif;
                        font-size:16px"></span></p>
                    <div>Message Body</div>
                    <div>    eXtensible Markup Language</div>
                    <div>        <?xml</div>
                    <div>            version="1.0"</div>
                    <div>            ?></div>
                    <div>        <presence</div>
                    <div>            xmlns="urn:ietf:params:xml:ns:pidf"</div>
                    <div>            entity=<a class="moz-txt-link-rfc2396E" href="mailto:sip:2002@sip.co.uk">"sip:2002@sip.co.uk"</a>></div>
                    <div>            <tuple</div>
                    <div>               
                      xmlns="urn:ietf:params:xml:ns:pidf"</div>
                    <div>                id="tuple_mixingid"></div>
                    <div>                <status></div>
                    <div>                    <basic></div>
                    <div>                        open</div>
                    <div>                        </basic></div>
                    <div>                    </status></div>
                    <div>                </tuple></div>
                    <div>               <dm:note></div>
                    <div>                    Available</div>
                    <div>                    </dm:note></div>
                    <div>                </presence></div>
                    <br>
                    <p><span
                        style="font-family:Calibri,Helvetica,sans-serif;
                        font-size:16px">Can I do this with add_body ?
                        And if so what syntax/ carrier breaks would be
                        required so it will parse? As I have had issues
                        trying to add multiple lines to commands before
                        and cant see it documented, if it is please
                        point me in the direction.</span></p>
                    <p><span
                        style="font-family:Calibri,Helvetica,sans-serif;
                        font-size:16px"><br>
                      </span></p>
                    <p><span
                        style="font-family:Calibri,Helvetica,sans-serif;
                        font-size:16px">Many thanks!</span></p>
                    <p><span
                        style="font-family:Calibri,Helvetica,sans-serif;
                        font-size:16px"><br>
                      </span></p>
                    <p><span
                        style="font-family:Calibri,Helvetica,sans-serif;
                        font-size:16px">Jon</span></p>
                    <p><span
                        style="font-family:Calibri,Helvetica,sans-serif;
                        font-size:16px"><br>
                      </span></p>
                    <br>
                    <br>
                    <div style="color:rgb(0,0,0)">
                      <hr tabindex="-1" style="display:inline-block;
                        width:98%">
                      <div id="divRplyFwdMsg" dir="ltr"><font
                          style="font-size:11pt" face="Calibri,
                          sans-serif" color="#000000"><b>From:</b>
                          Jonathan Hunter <a class="moz-txt-link-rfc2396E" href="mailto:hunterj91@hotmail.com"><hunterj91@hotmail.com></a><br>
                          <b>Sent:</b> 09 October 2017 09:39<br>
                          <b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:users@lists.opensips.org">users@lists.opensips.org</a><br>
                          <b>Subject:</b> Re: [OpenSIPS-Users] opensips
                          2.2 generate NOTIFY with status=available</font>
                        <div> </div>
                      </div>
                      <div>
                        <div id="divtagdefaultwrapper" dir="ltr"
                          style="font-size:12pt; color:#000000;
                          font-family:Calibri,Helvetica,sans-serif">
                          <div>Hi Răzvan,</div>
                          <div><br>
                          </div>
                          <div>Hope you are well? Thank you so much for
                            the response.</div>
                          <div><br>
                          </div>
                          <div>Essentially we are testing opensips with
                            a third-party receptionist console and I
                            have configured presence.  Now it works
                            perfectly when there are calls in progress,
                            and handsets, in particular yealink, and
                            bria soft-clients are on the phone.</div>
                          <div><br>
                          </div>
                          <div>The receptionist sends SUBSCRIBE, and
                            opensips responds with this contained within
                            the Message body;</div>
                          <div><br>
                          </div>
                          <div><br>
                          </div>
                          <div>Message Body</div>
                          <div>    eXtensible Markup Language</div>
                          <div>        <?xml</div>
                          <div>        <presence</div>
                          <div>           
                            xmlns="urn:ietf:params:xml:ns:pidf"</div>
                          <div>           
                            entity=<a class="moz-txt-link-rfc2396E" href="mailto:sip:2002@siproxy.co.uk">"sip:2002@siproxy.co.uk"</a>></div>
                          <div>            <tuple</div>
                          <div>               
                            xmlns="urn:ietf:params:xml:ns:pidf"</div>
                          <div>                id="tuple_mixingid"></div>
                          <div>                <status></div>
                          <div>                    <basic></div>
                          <div>                        open</div>
                          <div>                        </basic></div>
                          <div>                    </status></div>
                          <div>                </tuple></div>
                          <div>            <note</div>
                          <div>            <dm:person</div>
                          <div>               
                            xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model"</div>
                          <div>               
                            xmlns:rpid="urn:ietf:params:xml:ns:pidf:rpid"</div>
                          <div>                id="pers_mixingid"></div>
                          <div>                <rpid:activities></div>
                          <div>                   
                            <rpid:on-the-phone/></div>
                          <div>                   
                            </rpid:activities></div>
                          <div>                <dm:note></div>
                          <div>                    Proceeding</div>
                          <div>                    </dm:note></div>
                          <div>                </dm:person></div>
                          <div>            </presence></div>
                          <div><br>
                          </div>
                          <div><br>
                          </div>
                          <div>Now my problem specifically is letting
                            the console know when a user is online and
                            available, as when it sends a subscribe, in
                            this case to monitor extension 2002, which
                            is registered, it gets back;</div>
                          <div><br>
                          </div>
                          <div>Message Body</div>
                          <div>    eXtensible Markup Language</div>
                          <div>        <?xml</div>
                          <div>        <presence</div>
                          <div>           
                            xmlns="urn:ietf:params:xml:ns:pidf"</div>
                          <div>           
                            entity=<a class="moz-txt-link-rfc2396E" href="mailto:sip:2002@siproxy.co.uk">"sip:2002@siproxy.co.uk"</a>></div>
                          <div>            <tuple</div>
                          <div>               
                            xmlns="urn:ietf:params:xml:ns:pidf"</div>
                          <div>                id="tuple_mixingid"></div>
                          <div>                <status></div>
                          <div>                    <basic></div>
                          <div>                        closed</div>
                          <div>                        </basic></div>
                          <div>                    </status></div>
                          <div>                </tuple></div>
                          <div>            </presence></div>
                          <div><br>
                          </div>
                          <div><br>
                          </div>
                          <div>I would ideally like to send status=open
                            and <dm:note>Available</dm:note>
                            if a user is registered and available, is
                            this possible or do I need to manipulate the
                            body as you originally suggested?</div>
                          <div><br>
                          </div>
                          <div>As this will then let the console display
                            the user as green and available! :)</div>
                          <div><br>
                          </div>
                          <div>Many thanks!</div>
                          <div><br>
                          </div>
                          <div>Jon</div>
                          <br>
                          <br>
                          <br>
                          <div style="color:rgb(0,0,0)">
                            <hr tabindex="-1"
                              style="display:inline-block; width:98%">
                            <div id="divRplyFwdMsg" dir="ltr"><font
                                style="font-size:11pt" face="Calibri,
                                sans-serif" color="#000000"><b>From:</b>
                                Users
                                <a class="moz-txt-link-rfc2396E" href="mailto:users-bounces@lists.opensips.org"><users-bounces@lists.opensips.org></a>
                                on behalf of Răzvan Crainea
                                <a class="moz-txt-link-rfc2396E" href="mailto:razvan@opensips.org"><razvan@opensips.org></a><br>
                                <b>Sent:</b> 09 October 2017 09:18<br>
                                <b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:users@lists.opensips.org">users@lists.opensips.org</a><br>
                                <b>Subject:</b> Re: [OpenSIPS-Users]
                                opensips 2.2 generate NOTIFY with
                                status=available</font>
                              <div> </div>
                            </div>
                            <div><tt>Hi, Jonathan!<br>
                                <br>
                                A quick and blind answer is to catch the
                                NOTIFY messages in local_route and
                                change them as you want using regular
                                expressions on the message body.<br>
                                <br>
                                Perhaps I can offer a more elegant
                                solution for this issue if you are a bit
                                more explicit about what kind of events
                                are you generating presence for, and
                                when is this NOTIFY message sent?<br>
                                <br>
                                Best regards,<br>
                              </tt>
                              <pre class="moz-signature" cols="72">Răzvan Crainea
OpenSIPS Developer
<a class="moz-txt-link-abbreviated" href="http://www.opensips-solutions.com" id="LPlnk898770" previewremoved="true" moz-do-not-send="true">www.opensips-solutions.com</a></pre>
                              <div
                                id="LPBorder_GT_15075419101200.32824802165808387"
                                style="margin-bottom:20px;
                                overflow:auto; width:100%;
                                text-indent:0px">
                                <table
                                  id="LPContainer_15075419101160.9596557120061688"
                                  style="width:90%;
                                  background-color:rgb(255,255,255);
                                  overflow:auto; padding-top:20px;
                                  padding-bottom:20px; margin-top:20px;
                                  border-top:1px dotted
                                  rgb(200,200,200); border-bottom:1px
                                  dotted rgb(200,200,200)"
                                  cellspacing="0">
                                  <tbody>
                                    <tr style="border-spacing:0px"
                                      valign="top">
                                      <td
                                        id="TextCell_15075419101170.6558077846884529"
                                        colspan="2"
                                        style="vertical-align: top;
                                        padding: 0px; display:
                                        table-cell; position: relative;">
                                        <div
                                          id="LPTitle_15075419101180.37171352461417184"
                                          style="top:0px;
                                          color:rgb(0,120,215);
                                          font-weight:normal;
                                          font-size:21px;
                                          font-family:wf_segoe-ui_light,"Segoe
                                          UI Light","Segoe WP
                                          Light","Segoe
                                          UI","Segoe
                                          WP",Tahoma,Arial,sans-serif;
                                          line-height:21px">
                                          <a
                                            id="LPUrlAnchor_15075419101180.6527688264359435"
href="http://www.opensips-solutions.com/" target="_blank"
                                            style="text-decoration:none"
                                            moz-do-not-send="true">Home
                                            — OpenSIPS Solutions</a></div>
                                        <div
                                          id="LPMetadata_15075419101180.05590974421258266"
                                          style="margin:10px 0px 16px;
                                          color:rgb(102,102,102);
                                          font-weight:normal;
                                          font-family:wf_segoe-ui_normal,"Segoe
                                          UI","Segoe
                                          WP",Tahoma,Arial,sans-serif;
                                          font-size:14px;
                                          line-height:14px">
                                          <a class="moz-txt-link-abbreviated" href="http://www.opensips-solutions.com">www.opensips-solutions.com</a></div>
                                        <div
                                          id="LPDescription_15075419101190.4084812418670123"
                                          style="display:block;
                                          color:rgb(102,102,102);
                                          font-weight:normal;
                                          font-family:wf_segoe-ui_normal,"Segoe
                                          UI","Segoe
                                          WP",Tahoma,Arial,sans-serif;
                                          font-size:14px;
                                          line-height:20px;
                                          max-height:100px;
                                          overflow:hidden">
                                          OpenSIPS is a mature Open
                                          Source implementation of a SIP
                                          server. OpenSIPS is more than
                                          a SIP proxy/router as it
                                          includes application-level
                                          functionalities.</div>
                                      </td>
                                    </tr>
                                  </tbody>
                                </table>
                              </div>
                              <br>
                              <div class="moz-cite-prefix">On 10/05/2017
                                09:15 PM, Jonathan Hunter wrote:<br>
                              </div>
                              <blockquote type="cite">
                                <div id="divtagdefaultwrapper" dir="ltr"
                                  style="font-size:12pt; color:#000000;
font-family:Calibri,Helvetica,sans-serif">
                                  <div>Hi Guys,</div>
                                  <div><br>
                                  </div>
                                  <div>I am using opensips 2.2 and the
                                    presence modules to generate PUBLISH
                                    and NOTIFY messages.</div>
                                  <div><br>
                                  </div>
                                  <div>I can see with the NOTIFY message
                                    opensips is sending a status=closed,
                                    can I make it send a
                                    status=available if the extension is
                                    registered and ready for calls?</div>
                                  <div><br>
                                  </div>
                                  <div>Many thanks</div>
                                  <div><br>
                                  </div>
                                  <div>Jon</div>
                                  <div><br>
                                  </div>
                                  <div><br>
                                  </div>
                                  <div>Session Initiation Protocol
                                    (NOTIFY)</div>
                                  <div>    Request-Line: NOTIFY
                                    sip:SIPWATCHER:5063 SIP/2.0</div>
                                  <div>    Message Header</div>
                                  <div>    Message Body</div>
                                  <div>        eXtensible Markup
                                    Language</div>
                                  <div>            <?xml</div>
                                  <div>            <presence</div>
                                  <div>               
                                    xmlns="urn:ietf:params:xml:ns:pidf"</div>
                                  <div>               
                                    entity="sip:2002@SIPDOMAIN"></div>
                                  <div>                <tuple</div>
                                  <div>                   
                                    xmlns="urn:ietf:params:xml:ns:pidf"</div>
                                  <div>                   
                                    id="tuple_mixingid"></div>
                                  <div>                   
                                    <status></div>
                                  <div>                       
                                    <basic></div>
                                  <div>                           
                                    closed</div>
                                  <div>                           
                                    </basic></div>
                                  <div>                       
                                    </status></div>
                                  <div>                   
                                    </tuple></div>
                                  <div>                </presence></div>
                                  <div><br>
                                  </div>
                                  <br>
                                </div>
                                <br>
                                <fieldset class="mimeAttachmentHeader"></fieldset>
                                <br>
                                <pre>_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org" moz-do-not-send="true">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" moz-do-not-send="true">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
                              </blockquote>
                              <br>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>