Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Children Display

What is the SBC capacity?

...

In theexamplebelow the"exec_curl" extension is simply just running the curl app. The second extension "parse_curl_response" is cutting individual values separated by commas from the string. 

<extension name="exec_curl">
<condition>
  <action application="curl" data="http://X.X.X.X:8282/roting.php?number=${destination_number}&amp;callerid=${caller_id_number}"/>
    <action application="set" inline="true" data="auto_hunt=true"/>
    <action application="transfer" data="parse_curl_response"/>
  </condition>
</extension>

 

<extension name="parse_curl_response">
  <condition field="${curl_response_data}" expression="^(\w+),?(\w+)?,?(\w+)?$">
    <action application="log" data="crit value #1: $1"/>
    <action application="log" data="crit value #2: $2"/>
    <action application="log" data="crit value #3: $3"/>
  </condition>
</extension>

 

Now can see the values are stored in the variables $ 1, $ 2, $ 3 and you can use them as you like in your dial plan.

...

First, you want to create a condition to determine if the SIP request contains a Diversion header at all, and capture all the characters before the @ symbol, then capture the original host name, then the rest of the header value.

<condition field="${sip_h_Diversion}" expression="^(.+)@(.+):(.+)$" break="never">


Here we match the inbound SIP Diversion header (which is presented by the SBC variable sip_h_Diversion) and capture using parenthesis () 3 different values. Everything from the start of the header value until before the @ symbol, then everything after the @symbol but before the colon (before the port number) and then everything after the colon until the end of the header value.

Inside the condition now we can use those 3 captured values as the special variables $1, $2, and $3 respectively for every string inside the set of parenthesis. Inside the condition, we can export a new sip_h_Diversion variable with the modified values.

<action application="export" data="sip_h_Diversion=$1@public-server.domain.com:$3" />

Here we have replaced the contents of the host (which was captured in variable $2) and only used $1 and $3 and inserted the desired hostname. The SBC will generate the new outbound SIP request with the new Diversion header value.

...