What condition does the myapp_exec function run ?

Get help with installing, upgrading and running Asterisk.

Moderators: muppetmaster, Moderator, Support

What condition does the myapp_exec function run ?

Postby nwcoaster6 » Tue Jan 19, 2016 5:10 am

#include "asterisk.h"

#include "asterisk/file.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/lock.h"
#include "asterisk/app.h"

ASTERISK_FILE_VERSION(__FILE__, "$Revision$")

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <ctype.h>

static char *app = "helloapp"

static int myapp_exec(struct ast_channel *chan, const char *data)
{
int res=0;

FILE *fp=NULL;
int i=123;

fp=fopen("netc.txt","w+");

fprintf(fp,"%d\n",i);
i=111;
fprintf(fp,"%d\n",i);
i=222;
fprintf(fp,"%d\n",i);
i=333;
fprintf(fp,"%d\n",i);
i=666;
fprintf(fp,"%d\n",i);

fclose(fp);

return res;

}

static int load_module(void)
{

return ast_register_application_xml(app,myapp_exec);

}

static int unload_module(void)
{

return ast_unregister_application(app);

}

AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "MY OWN helloapp");


// end

What condition does the myapp_exec function run ?
or When call the myapp_exec function ?

Any help ?
nwcoaster6
Newsterisk
 
Posts: 6
Joined: Tue Jan 05, 2016 1:41 am

Re: What condition does the myapp_exec function run ?

Postby jcolp » Tue Jan 19, 2016 6:11 am

It is executed when the 'helloapp' dialplan application is used in the dialplan.
Joshua Colp
Digium, Inc. | Senior Software Developer
jcolp
Oldsterisk
 
Posts: 248
Joined: Tue May 19, 2015 6:59 am

Re: What condition does the myapp_exec function run ?

Postby nwcoaster6 » Tue Jan 19, 2016 8:04 pm

Could you give an example to call the myapp_exec function ?

Any help ?
nwcoaster6
Newsterisk
 
Posts: 6
Joined: Tue Jan 05, 2016 1:41 am

Re: What condition does the myapp_exec function run ?

Postby david55 » Wed Jan 20, 2016 2:04 am

1) This is a developer question, so off topic.

2) There are dozens of examples of how to call applications available on the web and in the sample configuration file,together with the source code of at least all the built-in ones.

3) This reads rather like a homework question.
david55
Moves Like Spencer
 
Posts: 12570
Joined: Fri Sep 26, 2008 5:03 am


Return to Asterisk Support

Who is online

Users browsing this forum: No registered users and 1 guest