Hello everyone.
I’m starting to learn Asterisk code to start to develop an app to asterisk, or improve exists.
My first app is to a simples DIAL context.
I’m trying to make this
exten _X.,1,Dial(SIP/number@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@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 for your help