This module provides OSP based call authentication, authorization, routing lookup and call detail record (CDR) collection services using standard FreeSWITCH application and dailplan interfaces.
1 Introduction
FreeSWITCH OSP module provides OSP based call authentication, authorization, routing lookup and call detail record (CDR) collection services using standard FreeSWITCH application interface and state handlers.
The OSP module can be configured by the following parameters in osp.conf.xml:
2 Configuration Parameters
The OSP module can be configured by OSP module global parameters and OSP provider profile parameters in osp.conf.xml.
Global parameters:
2.1 Global Parameters
FreeSWITCH OSP module global configuration parameters can be set using the following format:
<settings>
<param name="*NAME*" value="*VALUE*"/>
<param name="*NAME*" value="*VALUE*"/>
</settings>
Global parameter names and values can be:
- debug-info: Flag to show OSP module debug information. The default is "disabled".
- log-level: At which log level to show OSP module debug information. The default is "info".
- crypto-hardware: If to use hardware for OpenSSL. The default is "disabled".
- sip: Used SIP module and profile. The default is "sofia" and "external".
- h323: Used H.323 module and profile. The default is "h323" and "external". This option has not been implemented.
- iax: Used IAX2 module and profile. The default is "iax" and "external". This option has not been implemented.
- skype: Used Skype module and profile. The default is "skypopen" and "external". This option has not been implemented.
- default-protocol: The VoIP protocol for destinations with unknown/undefined protocol. The default is "sip".
debug-info: Flag to show OSP module debug information. The default is "disabled".
log-level: At which log level to show OSP module debug information. The default is "info".
crypto-hardware: If to use hardware for OpenSSL. The default is "disabled".
sip: Used SIP module and profile. The default is "sofia" and "external".
h323: Used H.323 module and profile. The default is "h323" and "external". This option has not been implemented.
iax: Used IAX2 module and profile. The default is "iax" and "external". This option has not been implemented.
skype: Used Skype module and profile. The default is "skypopen" and "external". This option has not been implemented.
default-protocol: The VoIP protocol for destinations with unknown/undefined protocol. The default is "sip".
OSP provider parameters:
2.2 OSP Provider Parameters
FreeSWITCH OSP module OSP provider configuration parameters can be set using the following format:
<profiles>
<profile name="default">
<param name="*NAME*" value="*VALUE*"/>
</profile>
<profile name="default">
<param name="*NAME*" value="*VALUE*"/>
</profile>
</profiles>
OSP provider parameter names ane values cab be:
- profile: OSP provider profile name.
- service-point-url: OSP service point URL. This parameter must be defined. Up to 8 URLs are allowed.
- device-ip: FreeSWITCH IP for OSP module. This parameter must be defined.
- ssl-lifetime: SSL lifetime. The default is 300 in seconds.
- http-max-connections: HTTP max connections. The default is 20.
- http-persistence: HTTP persistence. The default is 60 in seconds.
- http-retry-delay: HTTP retry delay. The default is 0 in seconds.
- http-retry-limit: HTTP retry times. The default is 2.
- http-timeout: HTTP timeout. The default is 10000 in ms.
- work-mode: OSP module work mode (direct and indirect). The default is "direct".
- service-type: OSP service type (voice and npquery). The default is "voice".
- max-destinations: Max destinations OSP server will return. It is up to 12. The default is 12.
3 OSP Applications
The OSP applications are called in dial plan like this:
<action application="osplookup" data="*PROFILE*>"/> and <action application="ospnext"/>
*PROFILE* is an OSP service provider profile name configured in osp.conf.xml. If data attribute is not provided or its value is empty, profile name "default" is used.
3.1 OSPLookup Application
osplookup application does OSP authorization request and gets first supported destination for inbound calls. It exports a set channel variables for FreeSWITCH dial plan logic.
osplookup application accepts two sets of channel variables that are used to pass additional inbound call information and outbound control parameters to OSP module. It also exports a set of channel variables for outbound channels and FreeSWITCH dial plan logic.
3.1.1 Inbound Call Information
- osp_source_device: Actual source device IP address channel variable. It is only for FreeSWITH OSP module running in indirect mode.
- osp_source_nid: Source device network ID channel variable.
- osp_custom_info_N: Up to 8 custom info channel variables. N is the index starting from 1.
3.1.2 Outbound Control Parameters
- osp_networkid_userparam: The URI user parameter name that is used to present destination network ID. For example, sip:callednumber;networkid=dnid@host.
- osp_networkid_uriparam: The URI parameter name that is used to present destination network ID. For example, sip:callednumber @host;networkid=dnid.
- osp_user_phone: Flag to add "user=phone" URI parameter. The default is "disabled".
- osp_outbound_proxy: Outbound proxy IP address channel variable.
3.1.3 Exported Parameters
- osp_profile_name: Used OSP provider profile name. It will be used by ospnext application and OSP module state handlers.
- osp_transaction_handle: OSP transaction handle. It will be used by ospnext application and OSP module state handlers.
- osp_transaction_id: OSP transaction ID. It will be used by ospnext application and OSP module state handlers for log purpose.
- osp_lookup_status: osplookup application status. It will be used by FreeSWITCH dial plan logic. 0 for no error.
- osp_route_total: Total number of destinations from OSP servers. It will be used by ospnext application and OSP module state handlers.
- osp_route_count: Destination index starting from 1. It will be used by ospnext application and OSP module state handlers.
- osp_auto_route: Bridge route string. It will be used by bridge application.
- osp_termiation_cause: Destination termination cause. It will be used by ospnext application and OSP module state handlers.
3.2 OSPNext Application
ospnext application gets next supported destination for inbound calls. It exports a set channel variables for FreeSWITCH dial plan logic.
ospnext application accepts a set of channel variables exported by osplookup application to pass OSP call transaction information to OSP module. It also exports a set of channel variables for outbound channels and FreeSWITCH dial plan logic.
3.2.1 Transaction Parameters
- osp_profile_name: Used OSP provider profile name.
- osp_transaction_handle: OSP transaction handle.
- osp_transaction_id: OSP transaction ID. It is for log purpose.
- osp_route_total: Total number of destinations from OSP servers.
- osp_route_count: destination index starting from 1.
- osp_next_status: ospnext application status. It will be used by FreeSWITCH dial plan logic. 0 for no error.
- osp_route_count: Destination index starting from 1. It will be used by ospnext application and OSP module state handlers.
- osp_termiation_cause: Destination termination cause. It will be used by ospnext application and OSP module state handlers.
- osp_auto_route: Bridge route string. It will be used by bridge application.
4 State Handler
OSP module state handler reports usage of calls.
OSP module state handler accepts a set of channel variables exported by osplookup and/or ospnext applications to pass OSP call transaction information to OSP module.
4.1 Transaction Parameters
- osp_profile_name: Used OSP provider profile name.
- osp_transaction_handle: OSP transaction handle.
- osp_transaction_id: OSP transaction ID. It is for log purpose.
- osp_route_total: Total number of destinations from OSP servers.
- osp_route_count: destination index starting from 1.
For both OSP application and dialplan, the <profilename> is an OSP service provider name configured in osp.conf.xml. If it is empty, profile "default" is used.
Both OSP application and dialplan accept a set of inbound channel variables that are used to pass additional call information to OSP module. These channel variables include:
osp_source_device: Actual source device IP address channel variable. It is only for FreeSWITH OSP module running in indirect mode.
osp_source_nid: Source device network ID channel variable.
osp_custom_info_N: Up to 8 custom info channel variables. N is the index starting from 1.
osp_networkid_userparam: The URI user parameter name that is used to present destination network ID.
osp_networkid_uriparam: The URI parameter name that is used to present destination network ID.
osp_user_phone: Flag to add "user=phone" URI parameter. The default is "disabled".
osp_outbound_proxy: Outbound proxy IP address channel variable.
Both OSP application and dialplan also export a set of channel variables for outbound channels and FreeSWITCH dial plan logic (for OSP dialplan, some exported channel variables are not visible for dial plan). These channel variables include:
osp_profile: Used OSP profile name. Used by outbound channels.
osp_transaction_id: OSP transaction ID. Used by outbound channels.
osp_calling: Original inbound calling number. Used by outbound channels.
osp_called: Original inbound called number. Used by outbound channels.
osp_start_time: Inbound call start time. Used by outbound channels.
osp_source_device: Actual source device. Used by outbound channels. It is only for FreeSWITH OSP module running in indirect mode.
osp_source_nid: Source network ID. Used by outbound channels.
osp_destination_total: Total number of destinations from OSP servers. Used by outbound channels.
osp_destination_count: Destination index. Used by outbound channels.
osp_destination_ip: Destination IP. Used by outbound channels.
osp_destination_nid: Destination network ID. Used by outbound channels.
osp_authreq_status: Authorization request result status.
osp_route_count: Number of supported destinations.
osp_route_N: Destination route string. N is the index starting from 1.
osp_auto_route: Bridge route string.
<!-- OSP logic for failed calls -->
<context name="osp_done">
<extension name="done">
<condition>
<!-- Respond 503 -->
<action application="respond" data="503 Service unavailable"/>