<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <tt>Hi Ping,<br>
      <br>
      So you need the B2B Logic ID only when you create the B2B session,
      in order to place it in the first outgoing INVITE (as extra hdr),
      right ?<br>
      <br>
      Regards,<br>
    </tt>
    <pre class="moz-signature" cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
    <div class="moz-cite-prefix">On 07.06.2016 04:59, Ping Han wrote:<br>
    </div>
    <blockquote
cite="mid:CAOooq9DZCUWWupDKkZxp5b1sQz=gBzBCmNnytyyw_FKVMb_67A@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div><span style="font-size:12.8px">Thanks, Bogdan,</span></div>
        <span style="font-size:12.8px">
          <div><span style="font-size:12.8px"><br>
            </span></div>
          What I am trying to do is to get the </span>b2b logic ID <span
          style="font-size:12.8px">and deliver to the next hop via a
          custom SIP header. </span>
        <div><span style="font-size:12.8px"><br>
          </span></div>
        <div><span style="font-size:12.8px">I am using
            the b2b_init_request("top hiding") and it looks like the
            only place that I can add a custom header is in the
            local_route. </span></div>
        <div><span style="font-size:12.8px"><br>
          </span></div>
        <div><span style="font-size:12.8px">So in the script I need the </span><span
            style="font-size:12.8px">b2b logic ID after running</span><span
            style="font-size:12.8px"> b2b_init_request("top hiding")</span><span
            style="font-size:12.8px"> but before the new INVITE is sent
            to the B party as shown below. </span></div>
        <div><span style="font-size:12.8px"><br>
          </span></div>
        <div><span style="font-size:12.8px">I am not sure how I can do
            that. </span></div>
        <div><span style="font-size:12.8px"><img
              src="cid:part1.07000402.05090101@opensips.org" alt="Inline
              image 2" width="342" height="248"><br>
          </span></div>
        <div><span style="font-size:12.8px"><br>
          </span></div>
        <div><span style="font-size:12.8px">Thanks, </span></div>
        <div><span style="font-size:12.8px">Ping</span></div>
        <div>
          <div>
            <div>
              <div class="gmail_extra"><br>
                <div class="gmail_quote">On Tue, Jun 7, 2016 at 12:07
                  AM, Bogdan-Andrei Iancu <span dir="ltr">&lt;<a
                      moz-do-not-send="true"
                      href="mailto:bogdan@opensips.org" target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:bogdan@opensips.org">bogdan@opensips.org</a></a>&gt;</span>
                  wrote:<br>
                  <blockquote class="gmail_quote" style="margin:0px 0px
                    0px
0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
                    <div text="#000000" bgcolor="#FFFFFF"> Hi Ping,<br>
                      <br>
                      My bad - in Call-ID and TO tag you have the B2B
                      _entity_ ID, while you need the B2B _logic_ ID
                      .....which is not part of the signaling at all .<br>
                      <br>
                      Now, in script, where do you need the b2b logic ID
                      ? after creating the B2B session (after b2b_init()
                      ) ? Or ?<span class=""><br>
                        <br>
                        Regards,<br>
                        <pre cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a moz-do-not-send="true" href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.com</a></pre>
                      </span>
                      <div>
                        <div class="h5">
                          <div>On 06.06.2016 11:46, Ping Han wrote:<br>
                          </div>
                          <blockquote type="cite">
                            <div dir="ltr">Thanks, Bogdan,
                              <div><br>
                              </div>
                              <div>I have done a few testing. It seems
                                only the value of the param works for
                                this function. However, it does not look
                                like the callid and the to-tag. </div>
                              <div>Is it possible to get the param value
                                in the Opensips config? </div>
                              <div><br>
                              </div>
                              <div>Please see the test results below. <br>
                                <div><br>
                                  <div>---------------------------------</div>
                                  <div>
                                    <div>[root@opensips-02 ~]#
                                      opensipsctl fifo b2be_list</div>
                                    <div>dlg:: 37 param=<span
                                        style="background-color:rgb(255,255,0)">237.0</span>
                                      state=5 last_invite_cseq=1
                                      last_method=0 last_reply_code=200
                                      db_flag=2</div>
                                    <div>        ruri:: <a
                                        moz-do-not-send="true"
                                        href="http://sip:2401012350@10.216.235.38:5060"
                                        target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:sip:2401012350@10.216.235.38:5060">sip:2401012350@10.216.235.38:5060</a></a></div>
                                    <div>        callid::
                                      NjEyZWEyOTEwZmVlZDIzOTViMTc3YjJiMmJmY2RjODI.</div>
                                    <div>        from:: "Tropo test"
                                      uri=<a moz-do-not-send="true"
                                        href="mailto:sip:2401012350@10.216.235.115:5060"
                                        target="_blank">sip:2401012350@10.216.235.115:5060</a>
                                      tag=1e53cf61</div>
                                    <div>        to:: "2401012350" uri=<a
                                        moz-do-not-send="true"
                                        href="mailto:sip:2401012350@10.216.235.115:5060"
                                        target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:sip:2401012350@10.216.235.115:5060">sip:2401012350@10.216.235.115:5060</a></a>
                                      tag=<span
                                        style="background-color:rgb(255,153,0)">B2B.297.37</span></div>
                                    <div>        cseq::  caller=1
                                      callee=1</div>
                                    <div>        route_set::
 caller=&lt;sip:10.216.235.72;lr;ftag=1e53cf61&gt;,&lt;sip:10.216.235.115;lr;ftag=1e53cf61&gt;</div>
                                    <div>        contact::  caller=<a
                                        moz-do-not-send="true"
                                        href="http://sip:2401012350@10.203.1.196:22238"
                                        target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:sip:2401012350@10.203.1.196:22238">sip:2401012350@10.203.1.196:22238</a></a>
                                      callee=sip:<a
                                        moz-do-not-send="true"
                                        href="http://10.216.235.72:5060"
                                        target="_blank">10.216.235.72:5060</a></div>
                                    <div>        send_sock::
                                      10.216.235.72</div>
                                    <div>dlg:: 6715348 param=<span
                                        style="background-color:rgb(255,255,0)">237.0</span>
                                      state=5 last_invite_cseq=2
                                      last_method=4 db_flag=2</div>
                                    <div>        callid:: <span
                                        style="background-color:rgb(0,255,0)">B2B.237.6715348</span></div>
                                    <div>        from:: "Tropo test"
                                      uri=<a moz-do-not-send="true"
                                        href="mailto:sip:2401012350@10.216.235.115:5060"
                                        target="_blank">sip:2401012350@10.216.235.115:5060</a>
tag=44623c403b25fd7905bfa7a7325b2b8f</div>
                                    <div>        to::  uri=<a
                                        moz-do-not-send="true"
                                        href="http://sip:dialog@10.216.235.38:5060"
                                        target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:sip:dialog@10.216.235.38:5060">sip:dialog@10.216.235.38:5060</a></a>
                                      tag=40711690</div>
                                    <div>        cseq::  caller=2
                                      callee=1</div>
                                    <div>        contact::  caller=sip:<a
                                        moz-do-not-send="true"
                                        href="http://10.216.235.72:5060"
                                        target="_blank">10.216.235.72:5060</a>
                                      callee=sip:<a
                                        moz-do-not-send="true"
                                        href="http://10.216.235.38:5060"
                                        target="_blank">10.216.235.38:5060</a></div>
                                    <div>        send_sock::
                                      10.216.235.72</div>
                                    <div>        LEGS::</div>
                                    <div>                leg:: 0
                                      tag=40711690 cseq=2 contact=sip:<a
                                        moz-do-not-send="true"
                                        href="http://10.216.235.38:5060"
                                        target="_blank">10.216.235.38:5060</a></div>
                                    <div><br>
                                    </div>
                                    <div>[root@opensips-02 ~]#
                                      opensipsctl fifo b2b_bridge <span
style="background-color:rgb(0,255,0)">237.6715348</span> <a
                                        moz-do-not-send="true"
                                        href="mailto:sip%3A123@10.203.1.196"
                                        target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:sip:123@10.203.1.196">sip:123@10.203.1.196</a></a>
                                       (this is the callid with out the
                                      "B2B" prefix)</div>
                                    <div>500 command 'b2b_bridge' failed</div>
                                    <div><br>
                                    </div>
                                    <div>[root@opensips-02 ~]#
                                      opensipsctl fifo b2b_bridge <span
style="background-color:rgb(255,153,0)">297.37</span>  <a
                                        moz-do-not-send="true"
                                        href="mailto:sip%3A123@10.203.1.196"
                                        target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:sip:123@10.203.1.196">sip:123@10.203.1.196</a></a>
                                       (this is the To-tag)</div>
                                    <div>500 command 'b2b_bridge' failed</div>
                                    <div><br>
                                    </div>
                                    <div>[root@opensips-02 ~]#
                                      opensipsctl fifo b2b_bridge <span
style="background-color:rgb(255,255,0)">237.0</span> <a
                                        moz-do-not-send="true"
                                        href="mailto:sip:123@10.203.1.196"
                                        target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:sip:123@10.203.1.196">sip:123@10.203.1.196</a></a>
                                      (this is the value of param, only
                                      this works)</div>
                                  </div>
                                  <div><br>
                                  </div>
                                  <div>---------------------------------<br>
                                  </div>
                                  <div><br>
                                  </div>
                                  <div>Regards,</div>
                                  <div>Ping </div>
                                  <div><br>
                                  </div>
                                </div>
                              </div>
                            </div>
                            <div class="gmail_extra"><br>
                              <div class="gmail_quote">On Fri, Jun 3,
                                2016 at 6:54 PM, Bogdan-Andrei Iancu <span
                                  dir="ltr">&lt;<a
                                    moz-do-not-send="true"
                                    href="mailto:bogdan@opensips.org"
                                    target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:bogdan@opensips.org">bogdan@opensips.org</a></a>&gt;</span>
                                wrote:<br>
                                <blockquote class="gmail_quote"
                                  style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
                                  <div text="#000000" bgcolor="#FFFFFF">
                                    <tt>Hi Ping,<br>
                                      <br>
                                      b2b_bridge_request() is a script
                                      function:<br>
                                          <a moz-do-not-send="true"
href="http://www.opensips.org/html/docs/modules/2.1.x/b2b_logic.html#id294094"
                                        target="_blank">http://www.opensips.org/html/docs/modules/2.1.x/b2b_logic.html#id294094</a><br>
                                      <br>
                                      I pointed to this function as you
                                      mentioned (on my question) that
                                      you want to do the bridging from
                                      script level.<br>
                                      <br>
                                      Indeed, the equivalent MI function
                                      is b2b_bridge:<br>
                                          <a moz-do-not-send="true"
href="http://www.opensips.org/html/docs/modules/2.1.x/b2b_logic.html#id294210"
                                        target="_blank">http://www.opensips.org/html/docs/modules/2.1.x/b2b_logic.html#id294210</a><br>
                                      <br>
                                      If you want to get that </tt><tt>"1020.30",
                                      you can get it from Call-ID or To
                                      tag, where you have B2B.</tt><tt><tt>1020.30

                                        (so you have to strip that B2B
                                        prefix).<br>
                                        <br>
                                        Regards,<br>
                                        <br>
                                      </tt></tt><span>
                                      <pre cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a moz-do-not-send="true" href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.com</a></pre>
                                    </span>
                                    <div>
                                      <div>
                                        <div>On 03.06.2016 06:27, Ping
                                          Han wrote:<br>
                                        </div>
                                        <blockquote type="cite">
                                          <div dir="ltr">Thanks, Bogdan,<br>
                                            <br>
                                            It seems the function you
                                            mentioned is the internal
                                            function  "1.4.2
                                            b2b_bridge_request(b2bl_key,entity_no)".
                                            <br>
                                            <br>
                                            Actually the function that I
                                            am trying to use is the
                                            "b2b_bridge" (Exported MI
                                            Functions). It is defined as
                                            below<br>
----------------------------------<br>
                                            <a moz-do-not-send="true"
href="http://www.opensips.org/html/docs/modules/2.1.x/b2b_logic.html#id294210"
                                              target="_blank">http://www.opensips.org/html/docs/modules/2.1.x/b2b_logic.html#id294210</a><br>
                                            <br>
                                            <br>
                                            1.5.2.  b2b_bridge<br>
                                            <br>
                                            Example: opensipsctl
                                            b2b_bridge 1020.30 <a
                                              moz-do-not-send="true"
                                              href="mailto:sip:alice@opensips.org"
                                              target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:sip:alice@opensips.org">sip:alice@opensips.org</a></a><br>
----------------------------------<br>
                                            <br>
                                            In the example "1020.30" is
                                            the "dialog-id". This is the
                                            parameter that I am not sure
                                            how to easily access in the
                                            Opensips config. <br>
                                            <br>
                                            What I am trying to do is to
                                            get the value and deliver to
                                            the next hop via a custom
                                            SIP header. When the next
                                            hop tries to transfer the
                                            call to a new destination.
                                            It can run the b2b_bridge
                                            command straight away with
                                            the "dialog-id" without
                                            rechieving the value from
                                            the Opensips database (from
                                            b2b_logic or b2b_entities
                                            tables). 
                                            <div><br>
                                            </div>
                                            <div>Any advice will be
                                              appreciated.</div>
                                            <div><br>
                                            </div>
                                            <div>Thanks,</div>
                                            <div>Ping<br>
                                              <br>
                                            </div>
                                          </div>
                                          <div class="gmail_extra"><br>
                                            <div class="gmail_quote">On
                                              Thu, Jun 2, 2016 at 5:35
                                              PM, Bogdan-Andrei Iancu <span
                                                dir="ltr">&lt;<a
                                                  moz-do-not-send="true"
href="mailto:bogdan@opensips.org" target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:bogdan@opensips.org">bogdan@opensips.org</a></a>&gt;</span>
                                              wrote:<br>
                                              <blockquote
                                                class="gmail_quote"
                                                style="margin:0px 0px
                                                0px
0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
                                                <div text="#000000"
                                                  bgcolor="#FFFFFF"> <tt>Hi

                                                    Ping,<br>
                                                    <br>
                                                    In script, in a b2b
                                                    route, you can look
                                                    at the callid or TO
                                                    tag (depending on
                                                    the direction) to
                                                    get the key :<br>
                                                        <a
                                                      moz-do-not-send="true"
href="http://www.opensips.org/html/docs/modules/2.2.x/b2b_logic.html#id294094"
                                                      target="_blank"><a class="moz-txt-link-freetext" href="http://www.opensips.org/html/docs/modules/2.2.x/b2b_logic.html#id294094">http://www.opensips.org/html/docs/modules/2.2.x/b2b_logic.html#id294094</a></a><br>
                                                    <br>
                                                    The B2B uses that
                                                    key as Call-ID when
                                                    acting as UAC and as
                                                    To tag when acting
                                                    as UAS. You can run
                                                    a SIP capture to see
                                                    the traffic.<br>
                                                    <br>
                                                    Regards,<br>
                                                  </tt><span>
                                                    <pre cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a moz-do-not-send="true" href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.com</a></pre>
                                                  </span>
                                                  <div>
                                                    <div>
                                                      <div>On 02.06.2016
                                                        05:13, Ping Han
                                                        wrote:<br>
                                                      </div>
                                                      <blockquote
                                                        type="cite">
                                                        <div dir="ltr">Hi
                                                          Bogdan,<br>
                                                          <br>
                                                          Thanks for the
                                                          information. <br>
                                                          <br>
                                                          I need the
                                                          value in the
                                                          Opensips cfg.
                                                          <br>
                                                          <br>
                                                          I understand
                                                          that I can
                                                          query the
                                                          b2b_logic or
                                                          b2b_entities
                                                          tables to get
                                                          the value in
                                                          Opensips
                                                          config. Apart
                                                          from that
                                                          could you tell
                                                          me other way
                                                          to easily
                                                          access the
                                                          value in
                                                          Opensips
                                                          config?
                                                          <div><br>
                                                          </div>
                                                          <div>Thanks,</div>
                                                          <div>Ping<br>
                                                          <div><br>
                                                          </div>
                                                          <div><br>
                                                          </div>
                                                          </div>
                                                        </div>
                                                        <div
                                                          class="gmail_extra"><br>
                                                          <div
                                                          class="gmail_quote">On
                                                          Wed, Jun 1,
                                                          2016 at 5:13
                                                          PM,
                                                          Bogdan-Andrei
                                                          Iancu <span
                                                          dir="ltr">&lt;<a
moz-do-not-send="true" href="mailto:bogdan@opensips.org" target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:bogdan@opensips.org">bogdan@opensips.org</a></a>&gt;</span>
                                                          wrote:<br>
                                                          <blockquote
                                                          class="gmail_quote"
                                                          style="margin:0px
                                                          0px 0px
0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
                                                          <div
                                                          text="#000000"
bgcolor="#FFFFFF"> <tt>Hi Ping,<br>
                                                          <br>
                                                          Indeed, my bad
                                                          - the docs are
                                                          not updated,
                                                          as that param
                                                          was disabled
                                                          long time ago
                                                          (4 years ago):<br>
                                                              <a
                                                          moz-do-not-send="true"
href="https://sourceforge.net/p/opensips/bugs/502/" target="_blank"><a class="moz-txt-link-freetext" href="https://sourceforge.net/p/opensips/bugs/502/">https://sourceforge.net/p/opensips/bugs/502/</a></a><br>
                                                          <br>
                                                          Still, there
                                                          are available
                                                          option. But
                                                          the question
                                                          is : do you
                                                          need that
                                                          value in
                                                          OpenSIPS cfg
                                                          or outside
                                                          OpenSIPS ? as
                                                          there are
                                                          different way
                                                          to get the ID.<br>
                                                          <br>
                                                          Regards,<br>
                                                          </tt><span>
                                                          <pre cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a moz-do-not-send="true" href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.com</a></pre>
                                                          </span> </div>
                                                          </blockquote>
                                                          </div>
                                                        </div>
                                                      </blockquote>
                                                    </div>
                                                  </div>
                                                </div>
                                              </blockquote>
                                            </div>
                                          </div>
                                        </blockquote>
                                      </div>
                                    </div>
                                  </div>
                                </blockquote>
                              </div>
                            </div>
                          </blockquote>
                          <br>
                        </div>
                      </div>
                    </div>
                  </blockquote>
                </div>
                <br>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>