HI All, Can You Please any one help me To Write Directory and Dialplan and In XML_CURL Like Below #################CODE######################## #!/usr/bin/perl use strict; use warnings; use Data::Dump qw(dump); use CGI; my $q = CGI->new; my $section = $q->param('section'); if ($section eq 'directory'){ $XML_STRING2 = ' <?xml version="1.0" encoding="UTF-8" standalone="no"?> <document type="freeswitch/xml"> <section name="directory"> <domain name="192.168.4.32"> <user id="1001"> <params> <param name="password" value="1001"/> </params> <variables> <variable name="accountcode" value="1001"/> <variable name="user_context" value="default"/> <variable name="effective_caller_id_name" value="1001"/> <variable name="nibble_rate" value="0.05"/> <variable name="nibble_account" value="1"/> <variable name="effective_caller_id_number" value="1001"/> </variables> </user> </domain> </section> '; } elsif ( $section eq 'dialplan' ) { $XML_STRING = ' <section name="dialplan" description="example_curl_dialplan"> <context name="public"> <extension name="curl_test"> <condition field="destination_number" expression="^(80\d{2})$"> <action application="set" data="dialed_extension=$1"/> <action application="set" data="nibble_account=${accountcode}"/> <action application="bridge" data="sofia/gateway/peer_asterisk/$1"/> </condition> </extension> </context> </section> </document> '; } ###########################END############################# This is Working for Me But i cant able to take the Database values into XML file Thanks In Advance Thanks J :: T
Hi all Any Update On 27 January 2013 18:46, johnthan123 <johnthan123@gmail.com> wrote:
HI All,
Can You Please any one help me To Write Directory and Dialplan and In XML_CURL Like Below
#################CODE######################## #!/usr/bin/perl use strict; use warnings; use Data::Dump qw(dump); use CGI; my $q = CGI->new; my $section = $q->param('section');
if ($section eq 'directory'){
$XML_STRING2 = ' <?xml version="1.0" encoding="UTF-8" standalone="no"?> <document type="freeswitch/xml"> <section name="directory"> <domain name="192.168.4.32"> <user id="1001"> <params> <param name="password" value="1001"/> </params> <variables> <variable name="accountcode" value="1001"/> <variable name="user_context" value="default"/> <variable name="effective_caller_id_name" value="1001"/> <variable name="nibble_rate" value="0.05"/> <variable name="nibble_account" value="1"/> <variable name="effective_caller_id_number" value="1001"/> </variables> </user> </domain> </section> '; } elsif ( $section eq 'dialplan' ) { $XML_STRING = ' <section name="dialplan" description="example_curl_dialplan"> <context name="public"> <extension name="curl_test"> <condition field="destination_number" expression="^(80\d{2})$"> <action application="set" data="dialed_extension=$1"/> <action application="set" data="nibble_account=${accountcode}"/> <action application="bridge" data="sofia/gateway/peer_asterisk/$1"/> </condition> </extension> </context> </section> </document> '; }
###########################END#############################
This is Working for Me But i cant able to take the Database values into XML file
Thanks In Advance
Thanks
J :: T
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Please refer to the link http://bit.ly/VKwFGY On Mon, Jan 28, 2013 at 6:06 AM, Jagadish Thoutam <jaganthoutam@gmail.com>wrote:
Hi all
Any Update
On 27 January 2013 18:46, johnthan123 <johnthan123@gmail.com> wrote:
HI All,
Can You Please any one help me To Write Directory and Dialplan and In XML_CURL Like Below
#################CODE######################## #!/usr/bin/perl use strict; use warnings; use Data::Dump qw(dump); use CGI; my $q = CGI->new; my $section = $q->param('section');
if ($section eq 'directory'){
$XML_STRING2 = ' <?xml version="1.0" encoding="UTF-8" standalone="no"?> <document type="freeswitch/xml"> <section name="directory"> <domain name="192.168.4.32"> <user id="1001"> <params> <param name="password" value="1001"/> </params> <variables> <variable name="accountcode" value="1001"/> <variable name="user_context" value="default"/> <variable name="effective_caller_id_name" value="1001"/> <variable name="nibble_rate" value="0.05"/> <variable name="nibble_account" value="1"/> <variable name="effective_caller_id_number" value="1001"/> </variables> </user> </domain> </section> '; } elsif ( $section eq 'dialplan' ) { $XML_STRING = ' <section name="dialplan" description="example_curl_dialplan"> <context name="public"> <extension name="curl_test"> <condition field="destination_number" expression="^(80\d{2})$"> <action application="set" data="dialed_extension=$1"/> <action application="set" data="nibble_account=${accountcode}"/> <action application="bridge" data="sofia/gateway/peer_asterisk/$1"/> </condition> </extension> </context> </section> </document> '; }
###########################END#############################
This is Working for Me But i cant able to take the Database values into XML file
Thanks In Advance
Thanks
J :: T
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
You need to return valid XML, your dialplan code path doesn't open the document tag. I suggest you read the Wiki page on the module, it gives several examples of the response you need to generate. http://wiki.freeswitch.org/wiki/Mod_xml_curl#XML_Usage -Steve On 27 January 2013 13:16, johnthan123 <johnthan123@gmail.com> wrote:
HI All,
Can You Please any one help me To Write Directory and Dialplan and In
XML_CURL Like Below
#################CODE######################## #!/usr/bin/perl use strict; use warnings; use Data::Dump qw(dump); use CGI; my $q = CGI->new; my $section = $q->param('section');
if ($section eq 'directory'){
$XML_STRING2 = ' <?xml version="1.0" encoding="UTF-8" standalone="no"?> <document type="freeswitch/xml"> <section name="directory"> <domain name="192.168.4.32"> <user id="1001"> <params> <param name="password" value="1001"/> </params> <variables> <variable name="accountcode" value="1001"/> <variable name="user_context" value="default"/> <variable name="effective_caller_id_name" value="1001"/> <variable name="nibble_rate" value="0.05"/> <variable name="nibble_account" value="1"/> <variable name="effective_caller_id_number" value="1001"/> </variables> </user> </domain> </section> '; } elsif ( $section eq 'dialplan' ) { $XML_STRING = ' <section name="dialplan" description="example_curl_dialplan"> <context name="public"> <extension name="curl_test"> <condition field="destination_number" expression="^(80\d{2})$"> <action application="set" data="dialed_extension=$1"/> <action application="set" data="nibble_account=${accountcode}"/> <action application="bridge"
data="sofia/gateway/peer_asterisk/$1"/>
</condition> </extension> </context> </section> </document> '; }
###########################END#############################
This is Working for Me But i cant able to take the Database values into
XML file
Thanks In Advance
Thanks
J :: T
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Once the response is nested in the correct document, section etc tags the XML syntax is identical to the static dialplan/directory/etc local files, except that you only need to return the parts relevant to the call. -Steve On 28 January 2013 13:49, Steven Ayre <steveayre@gmail.com> wrote:
You need to return valid XML, your dialplan code path doesn't open the document tag.
I suggest you read the Wiki page on the module, it gives several examples of the response you need to generate.
http://wiki.freeswitch.org/wiki/Mod_xml_curl#XML_Usage
-Steve
On 27 January 2013 13:16, johnthan123 <johnthan123@gmail.com> wrote:
HI All,
Can You Please any one help me To Write Directory and Dialplan and In
XML_CURL Like Below
#################CODE######################## #!/usr/bin/perl use strict; use warnings; use Data::Dump qw(dump); use CGI; my $q = CGI->new; my $section = $q->param('section');
if ($section eq 'directory'){
$XML_STRING2 = ' <?xml version="1.0" encoding="UTF-8" standalone="no"?> <document type="freeswitch/xml"> <section name="directory"> <domain name="192.168.4.32"> <user id="1001"> <params> <param name="password" value="1001"/> </params> <variables> <variable name="accountcode" value="1001"/> <variable name="user_context" value="default"/> <variable name="effective_caller_id_name" value="1001"/> <variable name="nibble_rate" value="0.05"/> <variable name="nibble_account" value="1"/> <variable name="effective_caller_id_number" value="1001"/> </variables> </user> </domain> </section> '; } elsif ( $section eq 'dialplan' ) { $XML_STRING = ' <section name="dialplan" description="example_curl_dialplan"> <context name="public"> <extension name="curl_test"> <condition field="destination_number" expression="^(80\d{2})$"> <action application="set" data="dialed_extension=$1"/> <action application="set" data="nibble_account=${accountcode}"/> <action application="bridge"
data="sofia/gateway/peer_asterisk/$1"/>
</condition> </extension> </context> </section> </document> '; }
###########################END#############################
This is Working for Me But i cant able to take the Database values into
XML file
Thanks In Advance
Thanks
J :: T
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Hi Jonathan, On a separate side note, that code is particularly unclean. You may want to consider either building the XML response using an XML library, or use a template parsing language so you are not placing raw XML in your source. In regards to your original email, the link Steven has provided is a good starting point. Hope this helps. Cal On Sun, Jan 27, 2013 at 1:16 PM, johnthan123 <johnthan123@gmail.com> wrote:
HI All,
Can You Please any one help me To Write Directory and Dialplan and In XML_CURL Like Below
#################CODE######################## #!/usr/bin/perl use strict; use warnings; use Data::Dump qw(dump); use CGI; my $q = CGI->new; my $section = $q->param('section');
if ($section eq 'directory'){
$XML_STRING2 = ' <?xml version="1.0" encoding="UTF-8" standalone="no"?> <document type="freeswitch/xml"> <section name="directory"> <domain name="192.168.4.32"> <user id="1001"> <params> <param name="password" value="1001"/> </params> <variables> <variable name="accountcode" value="1001"/> <variable name="user_context" value="default"/> <variable name="effective_caller_id_name" value="1001"/> <variable name="nibble_rate" value="0.05"/> <variable name="nibble_account" value="1"/> <variable name="effective_caller_id_number" value="1001"/> </variables> </user> </domain> </section> '; } elsif ( $section eq 'dialplan' ) { $XML_STRING = ' <section name="dialplan" description="example_curl_dialplan"> <context name="public"> <extension name="curl_test"> <condition field="destination_number" expression="^(80\d{2})$"> <action application="set" data="dialed_extension=$1"/> <action application="set" data="nibble_account=${accountcode}"/> <action application="bridge" data="sofia/gateway/peer_asterisk/$1"/> </condition> </extension> </context> </section> </document> '; }
###########################END#############################
This is Working for Me But i cant able to take the Database values into XML file
Thanks In Advance
Thanks
J :: T
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
hi john, #!/usr/bin/perl #!/usr/bin/perl use warnings; use strict; use XML::Writer; use XML::Writer::String; my $s = XML::Writer::String->new(); my $writer = new XML::Writer( OUTPUT => $s,DATA_MODE => 1, DATA_INDENT => 4); $writer->xmlDecl('UTF-8', 'no'); $writer->startTag('document', type=>'freeswitch/xml'); $writer->startTag('section',name=>'dialplan',description=>'RE Dial Plan For FreeSwitch'); $writer->startTag('context',name=>'public'); $writer->startTag('condition',field=>'destination_number',expression=>'^(80\d{2})$'); $writer->startTag('action',application=>'set',data=>'dialed_extension=$1'); $writer->startTag('action',application=>'bridge',data=>'sofia/gateway/peer_asterisk/$1'); $writer->endTag('action'); $writer->endTag('action'); $writer->endTag('condition'); $writer->endTag('context'); $writer->endTag('section'); $writer->endTag('document'); $writer->end(); print $s->value(); i Think This can help you Thanks Jagadish On 28 January 2013 22:40, Cal Leeming [Simplicity Media Ltd] <cal.leeming@simplicitymedialtd.co.uk> wrote:
Hi Jonathan,
On a separate side note, that code is particularly unclean.
You may want to consider either building the XML response using an XML library, or use a template parsing language so you are not placing raw XML in your source.
In regards to your original email, the link Steven has provided is a good starting point.
Hope this helps.
Cal
On Sun, Jan 27, 2013 at 1:16 PM, johnthan123 <johnthan123@gmail.com> wrote:
HI All,
Can You Please any one help me To Write Directory and Dialplan and In XML_CURL Like Below
#################CODE######################## #!/usr/bin/perl use strict; use warnings; use Data::Dump qw(dump); use CGI; my $q = CGI->new; my $section = $q->param('section');
if ($section eq 'directory'){
$XML_STRING2 = ' <?xml version="1.0" encoding="UTF-8" standalone="no"?> <document type="freeswitch/xml"> <section name="directory"> <domain name="192.168.4.32"> <user id="1001"> <params> <param name="password" value="1001"/> </params> <variables> <variable name="accountcode" value="1001"/> <variable name="user_context" value="default"/> <variable name="effective_caller_id_name" value="1001"/> <variable name="nibble_rate" value="0.05"/> <variable name="nibble_account" value="1"/> <variable name="effective_caller_id_number" value="1001"/> </variables> </user> </domain> </section> '; } elsif ( $section eq 'dialplan' ) { $XML_STRING = ' <section name="dialplan" description="example_curl_dialplan"> <context name="public"> <extension name="curl_test"> <condition field="destination_number" expression="^(80\d{2})$"> <action application="set" data="dialed_extension=$1"/> <action application="set" data="nibble_account=${accountcode}"/> <action application="bridge" data="sofia/gateway/peer_asterisk/$1"/> </condition> </extension> </context> </section> </document> '; }
###########################END#############################
This is Working for Me But i cant able to take the Database values into XML file
Thanks In Advance
Thanks
J :: T
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
participants (5)
-
Cal Leeming [Simplicity Media Ltd]
-
Jagadish Thoutam
-
johnthan123
-
Roger Castaldo
-
Steven Ayre