mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-09 11:28:25 +00:00
Add the appropriate jumping behavior that is the standard for 1.2.X to SIPGetHeader that is now deprecated in /trunk. #7111 (blitzrage!!!)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@26090 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -12786,10 +12786,14 @@ static char *app_sipgetheader = "SIPGetHeader";
|
|||||||
static char *synopsis_sipgetheader = "Get a SIP header from an incoming call";
|
static char *synopsis_sipgetheader = "Get a SIP header from an incoming call";
|
||||||
|
|
||||||
static char *descrip_sipgetheader = ""
|
static char *descrip_sipgetheader = ""
|
||||||
" SIPGetHeader(var=headername): \n"
|
" SIPGetHeader(var=headername[|options]): \n"
|
||||||
"Sets a channel variable to the content of a SIP header\n"
|
"Sets a channel variable to the content of a SIP header\n"
|
||||||
"Skips to priority+101 if header does not exist\n"
|
" Options:\n"
|
||||||
"Otherwise returns 0\n";
|
" j - Jump to priority n+101 if the requested header isn't found.\n"
|
||||||
|
" This application sets the following channel variable upon completion:\n"
|
||||||
|
" SIPGETSTATUS - This variable will contain the status of the attempt\n"
|
||||||
|
" FOUND | NOTFOUND\n"
|
||||||
|
" This application has been deprecated in favor of the SIP_HEADER function.\n";
|
||||||
|
|
||||||
/*! \brief sip_dtmfmode: change the DTMFmode for a SIP call (application) ---*/
|
/*! \brief sip_dtmfmode: change the DTMFmode for a SIP call (application) ---*/
|
||||||
static int sip_dtmfmode(struct ast_channel *chan, void *data)
|
static int sip_dtmfmode(struct ast_channel *chan, void *data)
|
||||||
@@ -12875,9 +12879,10 @@ static int sip_addheader(struct ast_channel *chan, void *data)
|
|||||||
/*! \brief sip_getheader: Get a SIP header (dialplan app) ---*/
|
/*! \brief sip_getheader: Get a SIP header (dialplan app) ---*/
|
||||||
static int sip_getheader(struct ast_channel *chan, void *data)
|
static int sip_getheader(struct ast_channel *chan, void *data)
|
||||||
{
|
{
|
||||||
|
char *argv, *varname = NULL, *header = NULL, *content, *options = NULL;
|
||||||
static int dep_warning = 0;
|
static int dep_warning = 0;
|
||||||
struct sip_pvt *p;
|
struct sip_pvt *p;
|
||||||
char *argv, *varname = NULL, *header = NULL, *content;
|
int priority_jump = 0;
|
||||||
|
|
||||||
if (!dep_warning) {
|
if (!dep_warning) {
|
||||||
ast_log(LOG_WARNING, "SIPGetHeader is deprecated, use the SIP_HEADER function instead.\n");
|
ast_log(LOG_WARNING, "SIPGetHeader is deprecated, use the SIP_HEADER function instead.\n");
|
||||||
@@ -12890,16 +12895,27 @@ static int sip_getheader(struct ast_channel *chan, void *data)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strchr (argv, '=') ) { /* Pick out argumenet */
|
if (strchr (argv, '=') ) { /* Pick out argument */
|
||||||
varname = strsep (&argv, "=");
|
varname = strsep (&argv, "=");
|
||||||
header = strsep (&argv, "\0");
|
if (strchr(argv, '|')) {
|
||||||
|
header = strsep (&argv, "|");
|
||||||
|
options = strsep (&argv, "\0");
|
||||||
|
} else {
|
||||||
|
header = strsep (&argv, "\0");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!varname || !header) {
|
if (!varname || !header) {
|
||||||
ast_log(LOG_DEBUG, "SipGetHeader: Ignoring command, Syntax error in argument\n");
|
ast_log(LOG_DEBUG, "SIPGetHeader: Ignoring command, Syntax error in argument\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (options) {
|
||||||
|
if (strchr(options, 'j'))
|
||||||
|
priority_jump = 1;
|
||||||
|
}
|
||||||
|
|
||||||
ast_mutex_lock(&chan->lock);
|
ast_mutex_lock(&chan->lock);
|
||||||
if (chan->type != channeltype) {
|
if (chan->type != channeltype) {
|
||||||
ast_log(LOG_WARNING, "Call this application only on incoming SIP calls\n");
|
ast_log(LOG_WARNING, "Call this application only on incoming SIP calls\n");
|
||||||
@@ -12911,9 +12927,16 @@ static int sip_getheader(struct ast_channel *chan, void *data)
|
|||||||
content = get_header(&p->initreq, header); /* Get the header */
|
content = get_header(&p->initreq, header); /* Get the header */
|
||||||
if (!ast_strlen_zero(content)) {
|
if (!ast_strlen_zero(content)) {
|
||||||
pbx_builtin_setvar_helper(chan, varname, content);
|
pbx_builtin_setvar_helper(chan, varname, content);
|
||||||
|
if (option_verbose > 2)
|
||||||
|
ast_verbose(VERBOSE_PREFIX_3 "SIPGetHeader: set variable %s to %s\n", varname, content);
|
||||||
|
pbx_builtin_setvar_helper(chan, "SIPGETSTATUS", "FOUND");
|
||||||
} else {
|
} else {
|
||||||
ast_log(LOG_WARNING,"SIP Header %s not found for channel variable %s\n", header, varname);
|
ast_log(LOG_WARNING,"SIP Header %s not found for channel variable %s\n", header, varname);
|
||||||
ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101);
|
if (priority_jump || option_priority_jumping) {
|
||||||
|
/* Goto priority n+101 if it exists, where n is the current priority number */
|
||||||
|
ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101);
|
||||||
|
}
|
||||||
|
pbx_builtin_setvar_helper(chan, "SIPGETSTATUS", "NOTFOUND");
|
||||||
}
|
}
|
||||||
|
|
||||||
ast_mutex_unlock(&chan->lock);
|
ast_mutex_unlock(&chan->lock);
|
||||||
|
|||||||
@@ -621,6 +621,7 @@ ${RQMSTATUS} * removequeuemember()
|
|||||||
${SENDIMAGESTATUS} * sendimage()
|
${SENDIMAGESTATUS} * sendimage()
|
||||||
${SENDTEXTSTATUS} * sendtext()
|
${SENDTEXTSTATUS} * sendtext()
|
||||||
${SENDURLSTATUS} * sendurl()
|
${SENDURLSTATUS} * sendurl()
|
||||||
|
${SIPGETSTATUS} * sipgetheader()
|
||||||
${SYSTEMSTATUS} * system()
|
${SYSTEMSTATUS} * system()
|
||||||
${TRANSFERSTATUS} * transfer()
|
${TRANSFERSTATUS} * transfer()
|
||||||
${TXTCIDNAMESTATUS} * txtcidname()
|
${TXTCIDNAMESTATUS} * txtcidname()
|
||||||
|
|||||||
Reference in New Issue
Block a user