[asterisk-app-dev] custom apps to make calls.
info at magnussolution.com
info at magnussolution.com
Thu Aug 23 10:25:34 CDT 2018
Hello everyone.
I’m start learn Asterisk code to start develop any app to asterisk, or improve exists.
My first app is to a simples DIAL context.
I’m try make this
exten _X.,1,Dial(SIP/number at trunk)
but using a custom APP
exten => _X.,Dial(Magnus(${EXTEN}))
I create the app_magnus.c
struct ast_dial *dial;
char *info;
info = ast_strdupa(data);
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(exten);
);
AST_STANDARD_APP_ARGS(args, info);
if (ast_strlen_zero(args. exten)) {
ast_log(LOG_WARNING, “%s requires an argument (exten)\n", app);
return -1;
}
if (!(dial = ast_dial_create())) {
ast_log(LOG_WARNING, "Failed to create dialing structure.\n");
return 0;
}
if (ast_dial_append(dial, "SIP", number, NULL) == -1) {
ast_log(LOG_ERROR, "Failed to add %s to outbound dial\n", "SIP");
ast_dial_destroy(dial);
return 0;
}
res = ast_dial_run(dial, args.exten at MYTRUNK, 0);
ast_bridge_basic_new();
ast_dial_hangup(dial);
ast_dial_destroy(dial);
the problem is:
When I answer the call in LEG b the LEG a hangup.
thanks your help
More information about the asterisk-app-dev
mailing list