[Freeswitch-users] mod_xml_curl sofia domain gateways

Zoltán Szabó zoell at zoell.us
Fri Nov 28 20:06:42 MSK 2014


Hi,

What I would like to do is, I need to handle multiple domains. Every domain
will have their own gateways and these domains will use only one sip
profile.

So first when I start FS I got a request:

*REQUEST 1:*
 hostname = [dev]
 section = [configuration]
 tag_name = [configuration]
 key_name = [name]
 key_value = [sofia.conf]
 Event-Name = [REQUEST_PARAMS]
 Core-UUID = [d03d1242-7722-11e4-b04c-0f0151b60864]
 FreeSWITCH-Hostname = [dev]
 FreeSWITCH-Switchname = [dev]
 FreeSWITCH-IPv4 = [192.168.0.132]
 FreeSWITCH-IPv6 = [::1]
 Event-Date-Local = [2014-11-28 17:20:13]
 Event-Date-GMT = [Fri, 28 Nov 2014 17:20:13 GMT]
 Event-Date-Timestamp = [1417195213442735]
 Event-Calling-File = [sofia.c]
 Event-Calling-Function = [config_sofia]
 Event-Calling-Line-Number = [3948]
 Event-Sequence = [18]

So this is requesting the sofia config, so I send back that xml:

*REPLY 1:*
<document type="freeswitch/xml"
          xmlns:py="http://genshi.edgewall.org/"
          xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
          xmlns:xsd="http://www.w3.org/2001/XMLSchema"
          xmlns="http://www.w3.org/1999/xhtml">
    <section name="configuration">
        <configuration name='sofia.conf' description='sofia endpoint'>
            <global_settings>
                <param name="log-level" value="9"/>
                <param name="auto-restart" value="true"/>
                <param name="debug-presence" value="0"/>
                <param name='accept-blind-reg' value='false'/>
                <param name="sip-trace" value="no"/>
                <param name="sip-capture" value="no"/>
                <param name="auth-calls" value="true"/>
                <param name="dtmf-type" value="rfc2833"/>
            </global_settings>
            <profiles>
                    <profile name='MainCCSIP'>
                        <domains>
                                <domain name="domain1.example.com"
alias="false" parse="true"/>
                        </domains>
                        <settings>
                            <param name="odbc-dsn" value=""/>
 lot of parameters...
                        </settings>
                        <gateways>
                        </gateways>
                    </profile>
            </profiles>
        </configuration>
    </section>
</document>


Than it realizes I have a profile specified here, so it requesting
something similar, with the profile name key:

*REQUEST 2:*
hostname = [dev]
section = [configuration]
tag_name = [configuration]
key_name = [name]
key_value = [sofia.conf]
Event-Name = [REQUEST_PARAMS]
Core-UUID = [199eb63c-7716-11e4-a68f-272cf7c86620]
FreeSWITCH-Hostname = [dev]
FreeSWITCH-Switchname = [dev]
FreeSWITCH-IPv4 = [192.168.0.132]
FreeSWITCH-IPv6 = [::1]
Event-Date-Local = [2014-11-28 16:46:53]
Event-Date-GMT = [Fri, 28 Nov 2014 16:46:53 GMT]
Event-Date-Timestamp = [1417193213090586]
Event-Calling-File = [sofia.c]
Event-Calling-Function = [config_sofia]
Event-Calling-Line-Number = [3948]
Event-Sequence = [934]
profile = [MainCCSIP]

I am not sure what does it want now but I will send back the same XML,
containing my domains (1 for now), the profile settings and no gateways
assigned to this profile:

*SAME REPLY1:*
<document type="freeswitch/xml"
          xmlns:py="http://genshi.edgewall.org/"
          xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
          xmlns:xsd="http://www.w3.org/2001/XMLSchema"
          xmlns="http://www.w3.org/1999/xhtml">
    <section name="configuration">
        <configuration name='sofia.conf' description='sofia endpoint'>
            <global_settings>
                <param name="log-level" value="9"/>
                <param name="auto-restart" value="true"/>
                <param name="debug-presence" value="0"/>
                <param name='accept-blind-reg' value='false'/>
                <param name="sip-trace" value="no"/>
                <param name="sip-capture" value="no"/>
                <param name="auth-calls" value="true"/>
                <param name="dtmf-type" value="rfc2833"/>
            </global_settings>
            <profiles>
                    <profile name='MainCCSIP'>
                        <domains>
                                <domain name="domain1.example.com"
alias="false" parse="true"/>
                        </domains>
                        <settings>
                            <param name="odbc-dsn" value=""/>
 lot of parameters...
                        </settings>
                        <gateways>
                        </gateways>
                    </profile>
            </profiles>
        </configuration>
    </section>
</document>

Please note I excluded all the parameters as there are a lot in the
original response.

Than I got a new request:

*REQUEST 3:*
hostname = [dev]
section = [configuration]
tag_name = [configuration]
key_name = [name]
key_value = [sofia.conf]
Event-Name = [REQUEST_PARAMS]
Core-UUID = [199eb63c-7716-11e4-a68f-272cf7c86620]
FreeSWITCH-Hostname = [dev]
FreeSWITCH-Switchname = [dev]
FreeSWITCH-IPv4 = [192.168.0.132]
FreeSWITCH-IPv6 = [::1]
Event-Date-Local = [2014-11-28 16:46:53]
Event-Date-GMT = [Fri, 28 Nov 2014 16:46:53 GMT]
Event-Date-Timestamp = [1417193213190626]
Event-Calling-File = [sofia.c]
Event-Calling-Function = [launch_sofia_worker_thread]
Event-Calling-Line-Number = [2658]
Event-Sequence = [938]
profile = [MainCCSIP]

I am wondering why is this request? The only difference is the calling
function. Anyway I am sending back the same as above.

Then I got an other request:

*REQUEST 4:*
hostname = [dev]
section = [directory]
tag_name = [domain]
key_name = [name]
key_value = [domain1.example.com]
Event-Name = [REQUEST_PARAMS]
Core-UUID = [199eb63c-7716-11e4-a68f-272cf7c86620]
FreeSWITCH-Hostname = [dev]
FreeSWITCH-Switchname = [dev]
FreeSWITCH-IPv4 = [192.168.0.132]
FreeSWITCH-IPv6 = [::1]
Event-Date-Local = [2014-11-28 16:46:53]
Event-Date-GMT = [Fri, 28 Nov 2014 16:46:53 GMT]
Event-Date-Timestamp = [1417193213330579]
Event-Calling-File = [sofia.c]
Event-Calling-Function = [launch_sofia_worker_thread]
Event-Calling-Line-Number = [2676]
Event-Sequence = [939]
purpose = [gateways]
profile = [MainCCSIP]

This seems fine as I have set parse=true in the domain parameters so now it
is requesting the gateways for my specific domain1.example.com domain. Now
I am sending back the following:

<document type="freeswitch/xml"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns="http://www.w3.org/1999/xhtml">
    <section name="directory">
            <domain name='domain1.example.com'></domain>
                <gateways>
                        <gateway name='TestGW'>
                            <variables>
                                <variable name="inbound_var_name"
 data="inbound_call=true"  direction="inbound"/>
                                <variable name="outbound_var_name"
data="outbound_call=true" direction="outbound"/>
                                <variable name="both_var_name"
data="gw=TestGW"/>
                            </variables>
                            <param name='username' value='testuser'/>
                            <param name='password' value='testpw'/>
                            <param name="realm" value="sip.testgw.com"/>
                            <param name="expire-seconds" value="600"/>
                            <param name='register' value='true'/>
                            <param name="register-transport" value="udp"/>
                            <param name='retry-seconds' value='30'/>
                            <param name="ping" value="60"/>
                            <param name='register' value='true'/>
                        </gateway>
                </gateways>
    </section>
</document>

Then I can not see anything in the fs cli related to this gateway. It does
not try to connect to it, I can not list it, and also can not see any
errors related to this even if I set every trace and debug level to the
maximum. I also tried to enclose the gateways node into the domain like:

<domain name='domain1.example.com'>
    <gateways>
       All gateway config here...
    </gateways>
</domain>

But I can not see anything which indicates that this is correct/incorrect
or what.

Is there any problem with this response or am I missing something? I have
not send back any other config that FS requests at this stage, just these.

Many thanks,
Zoltan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20141128/50ab7545/attachment-0001.html 


Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list