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: https://origsvn.digium.com/svn/asterisk/trunk@75400 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.6.0
Steve Murphy 18 years ago
parent dfc9970e15
commit 8a7732f067

@ -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;

@ -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;
};

@ -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;

@ -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;
};

@ -315,7 +315,7 @@ struct iax2_user {
int encmethods;
int amaflags;
int adsi;
unsigned int flags;
uint64_t flags;
int capability;
int maxauthreq; /*!< Maximum allowed outstanding AUTHREQs */
int curauthreq; /*!< Current number of outstanding AUTHREQs */
@ -353,7 +353,7 @@ struct iax2_peer {
int sockfd; /*!< Socket to use for transmission */
struct in_addr mask;
int adsi;
unsigned int flags;
uint64_t flags;
/* Dynamic Registration fields */
struct sockaddr_in defaddr; /*!< Default address if there is one */
@ -604,7 +604,7 @@ struct chan_iax2_pvt {
/*! Associated peer for poking */
struct iax2_peer *peerpoke;
/*! IAX_ flags */
unsigned int flags;
uint64_t flags;
int adsi;
/*! Transferring status */
@ -2758,7 +2758,7 @@ static void realtime_update_peer(const char *peername, struct sockaddr_in *sin,
struct create_addr_info {
int capability;
unsigned int flags;
uint64_t flags;
int maxtime;
int encmethods;
int found;

@ -104,7 +104,7 @@ static const struct ast_channel_tech local_tech = {
struct local_pvt {
ast_mutex_t lock; /* Channel private lock */
unsigned int flags; /* Private flags */
uint64_t flags; /* Private flags */
char context[AST_MAX_CONTEXT]; /* Context to call */
char exten[AST_MAX_EXTENSION]; /* Extension to call */
int reqformat; /* Requested format */

@ -639,7 +639,7 @@ struct sip_request {
int headers; /*!< # of SIP Headers */
int method; /*!< Method of this request */
int lines; /*!< Body Content */
unsigned int flags; /*!< SIP_PKT Flags for this packet */
uint64_t flags; /*!< SIP_PKT Flags for this packet */
char *header[SIP_MAX_HEADERS];
char *line[SIP_MAX_LINES];
char data[SIP_MAX_PACKET];
@ -1080,7 +1080,7 @@ struct sip_pkt {
int retrans; /*!< Retransmission number */
int method; /*!< SIP method for this packet */
int seqno; /*!< Sequence number */
unsigned int flags; /*!< non-zero if this is a response packet (e.g. 200 OK) */
uint64_t flags; /*!< non-zero if this is a response packet (e.g. 200 OK) */
struct sip_pvt *owner; /*!< Owner AST call */
int retransid; /*!< Retransmission ID */
int timer_a; /*!< SIP timer A, retransmission timer */
@ -11536,7 +11536,7 @@ static int sip_show_channel(int fd, int argc, char *argv[])
ast_cli(fd, " Original uri: %s\n", cur->uri);
if (!ast_strlen_zero(cur->cid_num))
ast_cli(fd, " Caller-ID: %s\n", cur->cid_num);
ast_cli(fd, " Need Destroy: %d\n", ast_test_flag(&cur->flags[0], SIP_NEEDDESTROY));
ast_cli(fd, " Need Destroy: %lld\n", ast_test_flag(&cur->flags[0], SIP_NEEDDESTROY));
ast_cli(fd, " Last Message: %s\n", cur->lastmsg);
ast_cli(fd, " Promiscuous Redir: %s\n", ast_test_flag(&cur->flags[0], SIP_PROMISCREDIR) ? "Yes" : "No");
ast_cli(fd, " Route: %s\n", cur->route ? cur->route->hop : "N/A");

@ -69,7 +69,7 @@ struct iax_template {
unsigned int server;
unsigned short serverport;
unsigned int altserver;
unsigned int flags;
uint64_t flags;
unsigned int format;
unsigned int tos;
} *templates;
@ -88,7 +88,7 @@ static struct iax_flag {
{ "disable3way", PROV_FLAG_DIS_THREEWAY },
};
char *iax_provflags2str(char *buf, int buflen, unsigned int flags)
char *iax_provflags2str(char *buf, int buflen, uint64_t flags)
{
int x;
@ -117,7 +117,7 @@ static unsigned int iax_str2flags(const char *buf)
int x;
int len;
int found;
unsigned int flags = 0;
uint64_t flags = 0;
char *e;
while(buf && *buf) {
e = strchr(buf, ',');

@ -45,7 +45,7 @@
#define PROV_FLAG_DIS_CIDCW (1 << 6) /* CID/CW Disabled */
#define PROV_FLAG_DIS_THREEWAY (1 << 7) /* Three-way calling, transfer disabled */
char *iax_provflags2str(char *buf, int buflen, unsigned int flags);
char *iax_provflags2str(char *buf, int buflen, uint64_t flags);
int iax_provision_reload(void);
int iax_provision_unload(void);
int iax_provision_build(struct iax_ie_data *provdata, unsigned int *signature, const char *template, int force);

@ -67,7 +67,7 @@ struct acf_odbc_query {
char writehandle[5][30];
char sql_read[2048];
char sql_write[2048];
unsigned int flags;
uint64_t flags;
int rowlimit;
struct ast_custom_function *acf;
};

@ -55,7 +55,7 @@ enum {
struct ast_jb_conf
{
/*! \brief Combination of the AST_JB_ENABLED, AST_JB_FORCED and AST_JB_LOG flags. */
unsigned int flags;
uint64_t flags;
/*! \brief Max size of the jitterbuffer implementation. */
long max_size;
/*! \brief Resynchronization threshold of the jitterbuffer implementation. */
@ -98,7 +98,7 @@ struct ast_jb
/*! \brief File for frame timestamp tracing. */
FILE *logfile;
/*! \brief Jitterbuffer internal state flags. */
unsigned int flags;
uint64_t flags;
};

@ -83,7 +83,7 @@ struct ast_cdr {
/*! What account number to use */
char accountcode[AST_MAX_ACCOUNT_CODE];
/*! flags */
unsigned int flags;
uint64_t flags;
/*! Unique Channel Identifier */
char uniqueid[32];
/*! User field */

@ -468,7 +468,7 @@ struct ast_channel {
(see \ref AstChanVar ) */
ast_group_t callgroup; /*!< Call group for call pickups */
ast_group_t pickupgroup; /*!< Pickup group - which calls groups can be picked up? */
unsigned int flags; /*!< channel flags of AST_FLAG_ type */
uint64_t flags; /*!< channel flags of AST_FLAG_ type */
unsigned short transfercapability; /*!< ISDN Transfer Capbility - AST_FLAG_DIGITAL is not enough */
AST_LIST_HEAD_NOLOCK(, ast_frame) readq;
int alertpipe[2];
@ -567,7 +567,7 @@ struct ast_bridge_config {
const char *end_sound;
const char *start_sound;
int firstpass;
unsigned int flags;
uint64_t flags;
};
struct chanmon;

@ -61,7 +61,7 @@ struct ast_channel_spy {
struct ast_channel *chan;
struct ast_channel_spy_queue read_queue;
struct ast_channel_spy_queue write_queue;
unsigned int flags;
uint64_t flags;
enum chanspy_states status;
const char *type;
/* The volume adjustment values are very straightforward:

@ -192,7 +192,7 @@ struct dundi_peer_status {
#define DEFAULT_MAXMS 2000
struct dundi_result {
unsigned int flags;
uint64_t flags;
int weight;
int expiration;
int techint;

@ -39,7 +39,7 @@ struct ast_call_feature {
char exten[FEATURE_MAX_LEN];
char default_exten[FEATURE_MAX_LEN];
int (*operation)(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense);
unsigned int flags;
uint64_t flags;
char app[FEATURE_APP_LEN];
char app_args[FEATURE_APP_ARGS_LEN];
char moh_class[FEATURE_MOH_LEN];

@ -102,7 +102,7 @@ struct aji_buddy {
char channel[160];
struct aji_resource *resources;
enum aji_btype btype;
unsigned int flags;
uint64_t flags;
};
struct aji_buddy_container {
@ -137,7 +137,7 @@ struct aji_client {
int timeout;
int message_timeout;
int authorized;
unsigned int flags;
uint64_t flags;
int component; /* 0 client, 1 component */
struct aji_buddy_container buddies;
AST_LIST_HEAD(messages,aji_message) messages;

@ -215,7 +215,7 @@ struct ast_module_info {
*/
const char *key;
unsigned int flags;
uint64_t flags;
};
void ast_module_register(const struct ast_module_info *);

@ -51,7 +51,7 @@ struct ast_speech {
/*! Structure lock */
ast_mutex_t lock;
/*! Set flags */
unsigned int flags;
uint64_t flags;
/*! Processing sound (used when engine is processing audio and getting results) */
char *processing_sound;
/*! Current state of structure */

@ -50,7 +50,7 @@
your variable.
The flag macros below use a set of compiler tricks to verify
that the caller is using an "unsigned int" variable to hold
that the caller is using an "unsigned long long" variable to hold
the flags, and nothing else. If the caller uses any other
type of variable, a warning message similar to this:
@ -64,7 +64,7 @@
\endverbatim
*/
extern unsigned int __unsigned_int_flags_dummy;
extern uint64_t __unsigned_int_flags_dummy;
#define ast_test_flag(p,flag) ({ \
typeof ((p)->flags) __p = (p)->flags; \
@ -146,7 +146,7 @@ extern unsigned int __unsigned_int_flags_dummy;
/*! \brief Structure used to handle boolean flags
*/
struct ast_flags {
unsigned int flags;
uint64_t flags;
};
struct ast_hostent {

@ -2454,7 +2454,7 @@ done:
int ast_internal_timing_enabled(struct ast_channel *chan)
{
int ret = ast_opt_internal_timing && chan->timingfd > -1;
ast_debug(5, "Internal timing is %s (option_internal_timing=%d chan->timingfd=%d)\n", ret? "enabled": "disabled", ast_opt_internal_timing, chan->timingfd);
ast_debug(5, "Internal timing is %s (option_internal_timing=%lld chan->timingfd=%d)\n", ret? "enabled": "disabled", ast_opt_internal_timing, chan->timingfd);
return ret;
}

@ -86,8 +86,8 @@ struct ast_module {
int usecount; /* the number of 'users' currently in this module */
struct module_user_list users; /* the list of users in the module */
struct {
unsigned int running:1;
unsigned int declined:1;
uint64_t running:1;
uint64_t declined:1;
} flags;
AST_LIST_ENTRY(ast_module) entry;
char resource[0];

@ -152,7 +152,7 @@ struct ast_rtp {
int send_payload;
int send_duration;
int nat;
unsigned int flags;
uint64_t flags;
struct sockaddr_in us; /*!< Socket representation of the local endpoint. */
struct sockaddr_in them; /*!< Socket representation of the remote endpoint. */
struct timeval rxcore;
@ -845,7 +845,7 @@ static struct ast_frame *process_cisco_dtmf(struct ast_rtp *rtp, unsigned char *
char resp = 0;
struct ast_frame *f = NULL;
unsigned char seq;
unsigned int flags;
uint64_t flags;
unsigned int power;
/* We should have at least 4 bytes in RTP data */
@ -888,7 +888,7 @@ static struct ast_frame *process_cisco_dtmf(struct ast_rtp *rtp, unsigned char *
event = data[3] & 0x1f;
if (option_debug > 2 || rtpdebug)
ast_debug(0, "Cisco DTMF Digit: %02x (len=%d, seq=%d, flags=%02x, power=%d, history count=%d)\n", event, len, seq, flags, power, (len - 4) / 2);
ast_debug(0, "Cisco DTMF Digit: %02x (len=%d, seq=%d, flags=%02llx, power=%d, history count=%d)\n", event, len, seq, flags, power, (len - 4) / 2);
if (event < 10) {
resp = '0' + event;
} else if (event < 11) {

@ -179,7 +179,7 @@ struct dundi_transaction {
dundi_eid them_eid; /*!< Their EID, to us */
ast_aes_encrypt_key ecx; /*!< AES 128 Encryption context */
ast_aes_decrypt_key dcx; /*!< AES 128 Decryption context */
unsigned int flags; /*!< Has final packet been sent */
uint64_t flags; /*!< Has final packet been sent */
int ttl; /*!< Remaining TTL for queries on this one */
int thread; /*!< We have a calling thread */
int retranstimer; /*!< How long to wait before retransmissions */
@ -892,7 +892,7 @@ static int cache_save(dundi_eid *eidpeer, struct dundi_request *req, int start,
/* Skip anything with an illegal pipe in it */
if (strchr(req->dr[x].dest, '|'))
continue;
snprintf(data + strlen(data), sizeof(data) - strlen(data), "%d/%d/%d/%s/%s|",
snprintf(data + strlen(data), sizeof(data) - strlen(data), "%lld/%d/%d/%s/%s|",
req->dr[x].flags, req->dr[x].weight, req->dr[x].techint, req->dr[x].dest,
dundi_eid_to_str_short(eidpeer_str, sizeof(eidpeer_str), &req->dr[x].eid));
}
@ -1154,7 +1154,7 @@ static int cache_lookup_internal(time_t now, struct dundi_request *req, char *ke
if (option_debug)
ast_log(LOG_DEBUG, "Found cache expiring in %d seconds!\n", expiration);
ptr += length + 1;
while((sscanf(ptr, "%d/%d/%d/%n", &(flags.flags), &weight, &tech, &length) == 3)) {
while((sscanf(ptr, "%lld/%d/%d/%n", &(flags.flags), &weight, &tech, &length) == 3)) {
ptr += length;
term = strchr(ptr, '|');
if (term) {

@ -1318,7 +1318,7 @@ static int ast_feature_interpret(struct ast_channel *chan, struct ast_channel *p
ast_copy_flags(&features, &(config->features_caller), AST_FLAGS_ALL);
else
ast_copy_flags(&features, &(config->features_callee), AST_FLAGS_ALL);
ast_debug(3, "Feature interpret: chan=%s, peer=%s, sense=%d, features=%d\n", chan->name, peer->name, sense, features.flags);
ast_debug(3, "Feature interpret: chan=%s, peer=%s, sense=%d, features=%lld\n", chan->name, peer->name, sense, features.flags);
ast_rwlock_rdlock(&features_lock);
for (x = 0; x < FEATURES_COUNT; x++) {

@ -138,7 +138,7 @@ struct mohclass {
int allowed_files;
/*! The current number of files loaded into the filearray */
int total_files;
unsigned int flags;
uint64_t flags;
/*! The format from the MOH source, not applicable to "files" mode */
int format;
/*! The pid of the external application delivering MOH */

@ -9,6 +9,7 @@
#include <regex.h>
#include <limits.h>
#include "asterisk/compat.h"
#include "asterisk/ast_expr.h"
#include "asterisk/channel.h"
#include "asterisk/module.h"

@ -21,6 +21,7 @@
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include <../include/asterisk/compat.h>
#include <../include/asterisk/ast_expr.h>
static int global_lineno = 1;

Loading…
Cancel
Save