Index: pbx/pbx_dundi.c =================================================================== --- pbx/pbx_dundi.c (revision 75303) +++ pbx/pbx_dundi.c (working copy) @@ -179,7 +179,7 @@ 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 @@ /* 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 @@ 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) { Index: channels/chan_sip.c =================================================================== --- channels/chan_sip.c (revision 75303) +++ channels/chan_sip.c (working copy) @@ -639,7 +639,7 @@ 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 @@ 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 @@ 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"); Index: channels/iax2-provision.c =================================================================== --- channels/iax2-provision.c (revision 75303) +++ channels/iax2-provision.c (working copy) @@ -69,7 +69,7 @@ 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 @@ { "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 @@ int x; int len; int found; - unsigned int flags = 0; + uint64_t flags = 0; char *e; while(buf && *buf) { e = strchr(buf, ','); Index: channels/chan_iax2.c =================================================================== --- channels/chan_iax2.c (revision 75303) +++ channels/chan_iax2.c (working copy) @@ -315,7 +315,7 @@ 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 @@ 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 @@ /*! Associated peer for poking */ struct iax2_peer *peerpoke; /*! IAX_ flags */ - unsigned int flags; + uint64_t flags; int adsi; /*! Transferring status */ @@ -2758,7 +2758,7 @@ struct create_addr_info { int capability; - unsigned int flags; + uint64_t flags; int maxtime; int encmethods; int found; Index: channels/iax2-provision.h =================================================================== --- channels/iax2-provision.h (revision 75303) +++ channels/iax2-provision.h (working copy) @@ -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); Index: channels/chan_local.c =================================================================== --- channels/chan_local.c (revision 75303) +++ channels/chan_local.c (working copy) @@ -104,7 +104,7 @@ 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 */ Index: apps/app_mixmonitor.c =================================================================== --- apps/app_mixmonitor.c (revision 75303) +++ apps/app_mixmonitor.c (working copy) @@ -97,7 +97,7 @@ char *filename; char *post_process; char *name; - unsigned int flags; + uint64_t flags; }; enum { @@ -226,7 +226,7 @@ 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; Index: apps/app_minivm.c =================================================================== --- apps/app_minivm.c (revision 75303) +++ apps/app_minivm.c (working copy) @@ -364,7 +364,7 @@ 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 @@ /*! \brief Options for leaving voicemail with the voicemail() application */ struct leave_vm_options { - unsigned int flags; + uint64_t flags; signed char record_gain; }; Index: apps/app_voicemail.c =================================================================== --- apps/app_voicemail.c (revision 75303) +++ apps/app_voicemail.c (working copy) @@ -370,7 +370,7 @@ 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 @@ } 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 @@ } struct leave_vm_options { - unsigned int flags; + uint64_t flags; signed char record_gain; }; Index: apps/app_dial.c =================================================================== --- apps/app_dial.c (revision 75303) +++ apps/app_dial.c (working copy) @@ -109,7 +109,8 @@ " 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 @@ 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_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 @@ struct chanlist { struct chanlist *next; struct ast_channel *chan; - unsigned int flags; + uint64_t flags; int forwards; }; @@ -1789,7 +1792,29 @@ 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; Index: funcs/func_odbc.c =================================================================== --- funcs/func_odbc.c (revision 75303) +++ funcs/func_odbc.c (working copy) @@ -67,7 +67,7 @@ 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; }; Index: include/asterisk/utils.h =================================================================== --- include/asterisk/utils.h (revision 75303) +++ include/asterisk/utils.h (working copy) @@ -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 @@ /*! \brief Structure used to handle boolean flags */ struct ast_flags { - unsigned int flags; + uint64_t flags; }; struct ast_hostent { Index: include/asterisk/chanspy.h =================================================================== --- include/asterisk/chanspy.h (revision 75303) +++ include/asterisk/chanspy.h (working copy) @@ -61,7 +61,7 @@ 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: Index: include/asterisk/channel.h =================================================================== --- include/asterisk/channel.h (revision 75303) +++ include/asterisk/channel.h (working copy) @@ -468,7 +468,7 @@ (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 @@ const char *end_sound; const char *start_sound; int firstpass; - unsigned int flags; + uint64_t flags; }; struct chanmon; Index: include/asterisk/cdr.h =================================================================== --- include/asterisk/cdr.h (revision 75303) +++ include/asterisk/cdr.h (working copy) @@ -83,7 +83,7 @@ /*! 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 */ Index: include/asterisk/features.h =================================================================== --- include/asterisk/features.h (revision 75303) +++ include/asterisk/features.h (working copy) @@ -39,7 +39,7 @@ 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]; Index: include/asterisk/speech.h =================================================================== --- include/asterisk/speech.h (revision 75303) +++ include/asterisk/speech.h (working copy) @@ -51,7 +51,7 @@ /*! 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 */ Index: include/asterisk/abstract_jb.h =================================================================== --- include/asterisk/abstract_jb.h (revision 75303) +++ include/asterisk/abstract_jb.h (working copy) @@ -55,7 +55,7 @@ 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 @@ /*! \brief File for frame timestamp tracing. */ FILE *logfile; /*! \brief Jitterbuffer internal state flags. */ - unsigned int flags; + uint64_t flags; }; Index: include/asterisk/module.h =================================================================== --- include/asterisk/module.h (revision 75303) +++ include/asterisk/module.h (working copy) @@ -215,7 +215,7 @@ */ const char *key; - unsigned int flags; + uint64_t flags; }; void ast_module_register(const struct ast_module_info *); Index: include/asterisk/dundi.h =================================================================== --- include/asterisk/dundi.h (revision 75303) +++ include/asterisk/dundi.h (working copy) @@ -192,7 +192,7 @@ #define DEFAULT_MAXMS 2000 struct dundi_result { - unsigned int flags; + uint64_t flags; int weight; int expiration; int techint; Index: include/asterisk/jabber.h =================================================================== --- include/asterisk/jabber.h (revision 75303) +++ include/asterisk/jabber.h (working copy) @@ -102,7 +102,7 @@ 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 @@ 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; Index: main/loader.c =================================================================== --- main/loader.c (revision 75303) +++ main/loader.c (working copy) @@ -86,8 +86,8 @@ 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]; Index: main/channel.c =================================================================== --- main/channel.c (revision 75303) +++ main/channel.c (working copy) @@ -2454,7 +2454,7 @@ 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; } Index: main/rtp.c =================================================================== --- main/rtp.c (revision 75303) +++ main/rtp.c (working copy) @@ -152,7 +152,7 @@ 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 @@ 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 @@ 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) { Index: res/res_features.c =================================================================== --- res/res_features.c (revision 75303) +++ res/res_features.c (working copy) @@ -1318,7 +1318,7 @@ 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++) { Index: res/res_musiconhold.c =================================================================== --- res/res_musiconhold.c (revision 75303) +++ res/res_musiconhold.c (working copy) @@ -138,7 +138,7 @@ 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 */ Index: utils/ael_main.c =================================================================== --- utils/ael_main.c (revision 75303) +++ utils/ael_main.c (working copy) @@ -9,6 +9,7 @@ #include #include +#include "asterisk/compat.h" #include "asterisk/ast_expr.h" #include "asterisk/channel.h" #include "asterisk/module.h" Index: utils/check_expr.c =================================================================== --- utils/check_expr.c (revision 75303) +++ utils/check_expr.c (working copy) @@ -21,6 +21,7 @@ #include #include #include +#include <../include/asterisk/compat.h> #include <../include/asterisk/ast_expr.h> static int global_lineno = 1;