Table of Contents
List of Examples
The B2BUA implementation in OpenSIPS is separated in two layers:
This module is a B2BUA upper level implementation that can be used with b2b_entities module to have B2BUA that can be configured to provide some PBX services. The B2B services are coded in an XML scenario document. The b2b_logic module examines this document and uses the functions provided by the b2b_entities module to achieve the actions specified in the document and enable the service.
A scenario can be instantiated in two ways:
The size of the hash table that stores the scenario instatiation entities.
Default value is “9” (512 records).
This parameter should be set with the path of a document that contains a scenario that can be instantiated from the script at the receipt of an initial message.
This parameter can be set more than once.
Example 1.2. Set script_scenario
parameter
... modparam("b2b_logic", "script_scenario", "/usr/local/opensips/scripts/b2b_prepaid.xml") ...
This parameter should be set with the path of a document that contains a scenario that can be instantiated with an MI command.
This parameter can be set more than once.
Example 1.3. Set script_scenario
parameter
... modparam("b2b_logic", "extern_scenario", "/usr/local/opensips/scripts/b2b_marketing.xml") ...
The time interval at which to search for an hanged b2b context. A scenario is considered expired if the duration of a session exceeds the lifetime specified in the scenario. At that moment, BYE is sent in all the dialogs from that context and the context is deleted.
Default value is “100”.
A list of SIP header names delimited by ';' that should be passed from the dialog of one side to the other side. There are a number of headers that are passed by default. They are:
If you wish some other headers to be passed also you should define them by setting this parameter.
Default value is “NULL”.
This parameter modifies the behaviour of the B2BUA when bridging and a provisional media uri is set. For playing media while the callee answers (that is connecting the caller to a media server), the bridging with the callee must start by sending an Invite to it. The correct way is to send an Invite without a body in this case, but it has been observed that not many gateways support this. So, the solution is to use the sdp received in the first Invite from the caller and put it as the body for this invite. By setting this parameter, this behavior is enabled.
Default value is “0”.
The IP address of the machine that will be used as Contact in the generated messages. This is compulsory only when using external scenarios. For the script scenarios, if it is not set, it is constructed dynamically from the socket where the initiating request was received. This socket will be used to send all the requests, replies for that scenario instantiation.
Example 1.7. Set server_address
parameter
... modparam("b2b_logic", "server_address", "sip:sa@10.10.10.10:5060") ...
The module offers the possibility to insert the original callid in a header in the generated Invites. If you want this, set this parameter to the name of the header in which to insert the original callid.
Example 1.8. Set init_callid_hdr
parameter
... modparam("b2b_logic", "init_callid_hdr", "Init-CallID") ...
This is the function that must be called by the script writer on an initial INVITE for which a B2B scenario must be instantiated. It is up to the script writer to decide which are the criteria to decide for which messages certain scenarios must be instantiated.
The first parameter is the identifier for the scenario. This is defined in the XML document as an attribute of the root node.
Then it can take at most 4 other parameters that represent the parameters for the xml scenario. The expected number of parameters is also specified as an attribute in the root node of the XML scenario.
NOTE: Do not call t_newtran() from the script on this request. It will be called internally by the function. Calling t_newtran() from the script will result in the transaction remaining in memory for ever.
Example 1.9. b2b_init_request
usage
... if(is_method("INVITE") && !has_totag() && prepaid_user()) b2b_init_request("prepaid", "sip:320@opensips.org:5070", "sip:321@opensips.org:5070")); ...
This command instantiated a B2B scenario.
Name: b2b_trigger_scenario
Parameters:
senario_id : the id of the scenario to be instantiated.
scenario parameters - it can take 4 more parameters that are scenario parameters
MI FIFO Command Format:
:b2b_trigger_scenario:fifo_reply marketing sip:bob@opensips.org sip:322@opensips.org:5070 sip:alice@opensips.org _empty_line_
This command can be used by an external application to tell B2BUA to bridge a call party from an on going dialog to another destination. By default the caller is bridged to the new uri and BYE is set to the callee. You can instead bridge the callee if you send 1 as the third parameter.
Name: b2b_trigger_scenario
Parameters:
dialog-id : the id of the dialog. If you set the module parameter dialog-id the server will include the dialogid in the generated Invites as the content of a header with name 'Dialog-ID'.
new uri - the uri of the new destination
flag to specify that the callee must be bridged to the new destination. It is optional. If not present the caller will be bridged.
MI FIFO Command Format:
opensipsctl fifo b2b_bridge 1020.30 sip:alice@opensips.org