[Freeswitch-dev] how to connect a dialplan with my own module

Michael Jerris mike at jerris.com
Sun Oct 4 14:12:29 PDT 2009


so your app names are lnp_getprefix lbs_getpublicphone cps_verifyphone  
and lookup_service_destination

Mike

On Oct 3, 2009, at 7:45 PM, Tihomir Culjaga wrote:

> this is how i do it:
>
>
> SWITCH_MODULE_LOAD_FUNCTION(mod_optimaload)
> {
>         switch_application_interface_t *app_interface;
>
>         *module_interface =  
> switch_loadable_module_create_module_interface(pool,
>                 modname);
>         SWITCH_ADD_APP(app_interface, "lnp_getprefix", NULL, NULL,  
> lnp_getprefix_function, "in <recipient_data>, out <varname>",  
> SAF_SUPPORT_NOMEDIA);
>         SWITCH_ADD_APP(app_interface, "lbs_getpublicphone", NULL,  
> NULL, lbs_getpublicphone_function, "in <inviter_data>, in  
> <recipient_data>, out <varname>", SAF_SUPPORT_NOMEDIA);
>         SWITCH_ADD_APP(app_interface, "cps_verifyphone", NULL, NULL,  
> cps_verifyphone_function, "in <recipient_data>, out <varname>",  
> SAF_SUPPORT_NOMEDIA);
>         SWITCH_ADD_APP(app_interface, "lookup_service_destination",  
> NULL, NULL, lookup_service_destination_params_function, "in  
> <inviter_phone>, in <inviter_prefix>, in <recipient_phone>, in  
> <recipient_prefix>, in <redirect_gw_address>, out <contacts>, out  
> <radius_auth_result>", SAF_SUPPORT_NOMEDIA);
>
>
>         config_optima();
>         config_otidka();
>
>         unit_tests();
>
>         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,
>                         "mod optima services is loaded.\n");
>
>         return SWITCH_STATUS_SUCCESS;
> }
>
>
>
>
> later in the DP you just do this:
>
>       <extension name="LNP">
>         <condition field="destination_number" expression="(^300000) 
> (.*)">
>           <action application="lnp_getprefix" data="in $2, out  
> reroutingalias"/>
>           <action application="redirect" data="sip:${reroutingalias}@10.4.13.11:5060 
> "/>
>         </condition>
>       </extension>
>
>
>
> T.
>
>
> On Sat, Oct 3, 2009 at 5:56 PM, Michael Jerris <mike at jerris.com>  
> wrote:
> You are wanting to execute a dialplan application.  Take a look at  
> mod_skel, or a simple module in src/mod/applications such as mod_rss  
> for an example of how to write the code.  In your module you set the  
> name of the application you are registering and then you use that  
> name in the dialplan.
>
> Mike
>
>
> On Oct 3, 2009, at 11:45 AM, Francisco Scaramanga wrote:
>
>> I want to create my own freeswitch module which should simply  
>> answer a call and write the audiostream into a file.
>> Here is the dialplan:
>>
>>     <extension name="my new module">
>>       <condition field="destination_number" expression="^54321$">
>>         <action application="mod_myModul" data=""/>
>>       </condition>
>>     </extension>
>>
>>  The question is how the dialplan entry  
>> (application="mod_myModule") gets associated with mod_myModul so  
>> that the dialplan actually executes mod_myModul? I need to  
>> understand the mechanism in general but I can't find useful  
>> documentation for that.
>>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20091004/9a61fd5b/attachment-0001.html 


More information about the FreeSWITCH-dev mailing list