From cdfb9990ad122b984e00eed53e8f2f7858e3338f Mon Sep 17 00:00:00 2001 From: murf Date: Tue, 17 Jul 2007 19:40:29 +0000 Subject: via 10206, I have added an option (e) to Dial to allow the h exten to get run on peer. Had to upgrade ast_flag stuff to 64 bits to do this. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@75400 f38db490-d61c-443f-a65b-d21fe96a405b --- apps/app_dial.c | 35 ++++++++++++++++++++++++++++++----- apps/app_minivm.c | 4 ++-- apps/app_mixmonitor.c | 4 ++-- apps/app_voicemail.c | 6 +++--- 4 files changed, 37 insertions(+), 12 deletions(-) (limited to 'apps') diff --git a/apps/app_dial.c b/apps/app_dial.c index d9b068dc7..ac97f5a32 100644 --- a/apps/app_dial.c +++ b/apps/app_dial.c @@ -109,7 +109,8 @@ static char *descrip = " party has answered, but before the call gets bridged. The 'called'\n" " DTMF string is sent to the called party, and the 'calling' DTMF\n" " string is sent to the calling party. Both parameters can be used\n" -" alone.\n" +" alone.\n" +" e - execute the 'h' extension for peer after the call ends\n" " f - Force the callerid of the *calling* channel to be set as the\n" " extension associated with the channel using a dialplan 'hint'.\n" " For example, some PSTNs do not allow CallerID to be set to anything\n" @@ -256,10 +257,11 @@ enum { OPT_IGNORE_FORWARDING = (1 << 27), OPT_CALLEE_GOSUB = (1 << 28), OPT_CANCEL_ELSEWHERE = (1 << 29), + OPT_PEER_H = (1 << 30), }; -#define DIAL_STILLGOING (1 << 30) -#define DIAL_NOFORWARDHTML (1 << 31) +#define DIAL_STILLGOING (1 << 31) +#define DIAL_NOFORWARDHTML ((uint64_t)1 << 32) /* flags are now 64 bits, so keep it up! */ enum { OPT_ARG_ANNOUNCE = 0, @@ -282,6 +284,7 @@ AST_APP_OPTIONS(dial_exec_options, { AST_APP_OPTION('c', OPT_CANCEL_ELSEWHERE), AST_APP_OPTION('d', OPT_DTMF_EXIT), AST_APP_OPTION_ARG('D', OPT_SENDDTMF, OPT_ARG_SENDDTMF), + AST_APP_OPTION('e', OPT_PEER_H), AST_APP_OPTION('f', OPT_FORCECLID), AST_APP_OPTION('g', OPT_GO_ON), AST_APP_OPTION_ARG('G', OPT_GOTO, OPT_ARG_GOTO), @@ -314,7 +317,7 @@ AST_APP_OPTIONS(dial_exec_options, { struct chanlist { struct chanlist *next; struct ast_channel *chan; - unsigned int flags; + uint64_t flags; int forwards; }; @@ -1789,7 +1792,29 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags snprintf(toast, sizeof(toast), "%ld", (long)(end_time - start_time)); pbx_builtin_setvar_helper(chan, "DIALEDTIME", toast); - + + + if (ast_test_flag(&opts, OPT_PEER_H)) { + ast_log(LOG_NOTICE,"PEER context: %s; PEER exten: %s; PEER priority: %d\n", + peer->context, peer->exten, peer->priority); + } + + strcpy(peer->context, chan->context); + + if (ast_test_flag(&opts, OPT_PEER_H) && ast_exists_extension(peer, peer->context, "h", 1, peer->cid.cid_num)) { + strcpy(peer->exten, "h"); + peer->priority = 1; + while (ast_exists_extension(peer, peer->context, peer->exten, peer->priority, peer->cid.cid_num)) { + if ((res = ast_spawn_extension(peer, peer->context, peer->exten, peer->priority, peer->cid.cid_num))) { + /* Something bad happened, or a hangup has been requested. */ + ast_debug(1, "Spawn extension (%s,%s,%d) exited non-zero on '%s'\n", peer->context, peer->exten, peer->priority, peer->name); + if (option_verbose > 1) + ast_verbose( VERBOSE_PREFIX_2 "Spawn extension (%s, %s, %d) exited non-zero on '%s'\n", peer->context, peer->exten, peer->priority, peer->name); + break; + } + peer->priority++; + } + } if (res != AST_PBX_NO_HANGUP_PEER) { if (!chan->_softhangup) chan->hangupcause = peer->hangupcause; diff --git a/apps/app_minivm.c b/apps/app_minivm.c index 2bc3da3b7..24ebd0cb9 100644 --- a/apps/app_minivm.c +++ b/apps/app_minivm.c @@ -364,7 +364,7 @@ struct minivm_account { char attachfmt[80]; /*!< Format for voicemail audio file attachment */ char etemplate[80]; /*!< Pager template */ char ptemplate[80]; /*!< Voicemail format */ - unsigned int flags; /*!< MVM_ flags */ + uint64_t flags; /*!< MVM_ flags */ struct ast_variable *chanvars; /*!< Variables for e-mail template */ double volgain; /*!< Volume gain for voicemails sent via e-mail */ AST_LIST_ENTRY(minivm_account) list; @@ -395,7 +395,7 @@ static AST_LIST_HEAD_STATIC(message_templates, minivm_template); /*! \brief Options for leaving voicemail with the voicemail() application */ struct leave_vm_options { - unsigned int flags; + uint64_t flags; signed char record_gain; }; diff --git a/apps/app_mixmonitor.c b/apps/app_mixmonitor.c index fbbde45aa..3df6676dc 100644 --- a/apps/app_mixmonitor.c +++ b/apps/app_mixmonitor.c @@ -97,7 +97,7 @@ struct mixmonitor { char *filename; char *post_process; char *name; - unsigned int flags; + uint64_t flags; }; enum { @@ -226,7 +226,7 @@ static void *mixmonitor_thread(void *obj) return NULL; } -static void launch_monitor_thread(struct ast_channel *chan, const char *filename, unsigned int flags, +static void launch_monitor_thread(struct ast_channel *chan, const char *filename, uint64_t flags, int readvol, int writevol, const char *post_process) { pthread_t thread; diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index b700e76b2..96461fce9 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -370,7 +370,7 @@ struct ast_vm_user { char uniqueid[20]; /*!< Unique integer identifier */ char exit[80]; char attachfmt[20]; /*!< Attachment format */ - unsigned int flags; /*!< VM_ flags */ + uint64_t flags; /*!< VM_ flags */ int saydurationm; int maxmsg; /*!< Maximum number of msgs per folder for this mailbox */ int maxsecs; /*!< Maximum number of seconds per message for this mailbox */ @@ -2193,7 +2193,7 @@ static int sendmail(char *srcemail, struct ast_vm_user *vmu, int msgnum, char *c } if (!strcmp(format, "wav49")) format = "WAV"; - ast_debug(3, "Attaching file '%s', format '%s', uservm is '%d', global is %d\n", attach, format, attach_user_voicemail, ast_test_flag((&globalflags), VM_ATTACH)); + ast_debug(3, "Attaching file '%s', format '%s', uservm is '%d', global is %lld\n", attach, format, attach_user_voicemail, ast_test_flag((&globalflags), VM_ATTACH)); /* Make a temporary file instead of piping directly to sendmail, in case the mail command hangs */ if ((p = vm_mkftemp(tmp)) == NULL) { @@ -2991,7 +2991,7 @@ static void run_externnotify(char *context, char *extension) } struct leave_vm_options { - unsigned int flags; + uint64_t flags; signed char record_gain; }; -- cgit v1.2.3