diff --git a/app.c b/app.c index 5621773dd..0ea51f8a6 100755 --- a/app.c +++ b/app.c @@ -58,9 +58,9 @@ int ast_app_dtget(struct ast_channel *chan, const char *context, char *collect, timeout = 5; ts = ast_get_indication_tone(chan->zone,"dial"); - if (ts && ts->data[0]) { - res = ast_playtones_start(chan, 0, ts->data, 0); - } else + if (ts && ts->data[0]) + res = ast_playtones_start(chan, 0, ts->data, 0); + else ast_log(LOG_NOTICE,"Huh....? no dial for indications?\n"); for (x = strlen(collect); strlen(collect) < maxlen; ) { @@ -105,8 +105,10 @@ int ast_app_getdata(struct ast_channel *c, char *prompt, char *s, int maxlen, in fto = c->pbx ? c->pbx->rtimeout * 1000 : 6000; to = c->pbx ? c->pbx->dtimeout * 1000 : 2000; - if (timeout > 0) fto = to = timeout; - if (timeout < 0) fto = to = 1000000000; + if (timeout > 0) + fto = to = timeout; + if (timeout < 0) + fto = to = 1000000000; res = ast_readstring(c, s, maxlen, to, fto, "#"); return res; } @@ -122,8 +124,10 @@ int ast_app_getdata_full(struct ast_channel *c, char *prompt, char *s, int maxle } fto = 6000; to = 2000; - if (timeout > 0) fto = to = timeout; - if (timeout < 0) fto = to = 1000000000; + if (timeout > 0) + fto = to = timeout; + if (timeout < 0) + fto = to = 1000000000; res = ast_readstring_full(c, s, maxlen, to, fto, "#", audiofd, ctrlfd); return res; } diff --git a/apps/app_read.c b/apps/app_read.c index d9f30ded2..cb30a7a66 100755 --- a/apps/app_read.c +++ b/apps/app_read.c @@ -44,7 +44,7 @@ static char *descrip = " or 'noanswer' to read digits even if the line is not up.\n" " attempts -- if greater than 1, that many attempts will be made in the \n" " event no data is entered.\n" -" timeout -- if greater than 0, that value will override the default timeoft.\n\n" +" timeout -- if greater than 0, that value will override the default timeout.\n\n" "Returns -1 on hangup or error and 0 otherwise.\n"; STANDARD_LOCAL_USER; diff --git a/astmm.c b/astmm.c index c249091ee..4f6c60c7b 100755 --- a/astmm.c +++ b/astmm.c @@ -3,9 +3,9 @@ * * Channel Variables * - * Copyright (C) 2002, Mark Spencer + * Copyright (C) 2002-2005, Mark Spencer * - * Mark Spencer + * Mark Spencer * * This program is free software, distributed under the terms of * the GNU General Public License diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index adf102579..1aa908531 100755 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -212,14 +212,14 @@ struct iax2_context { #define IAX_ALREADYGONE (1 << 9) /* Already disconnected */ #define IAX_PROVISION (1 << 10) /* This is a provisioning request */ #define IAX_QUELCH (1 << 11) /* Whether or not we quelch audio */ -#define IAX_ENCRYPTED (1 << 12) /* Whether we should assume encrypted tx/rx */ -#define IAX_KEYPOPULATED (1 << 13) /* Whether we have a key populated */ -#define IAX_CODEC_USER_FIRST (1 << 14) /* are we willing to let the other guy choose the codec? */ -#define IAX_CODEC_NOPREFS (1 << 15) /* Force old behaviour by turning off prefs */ -#define IAX_CODEC_NOCAP (1 << 16) /* only consider requested format and ignore capabilities*/ -#define IAX_RTCACHEFRIENDS (1 << 17) /* let realtime stay till your reload */ -#define IAX_RTNOUPDATE (1 << 18) /* Don't send a realtime update */ -#define IAX_RTAUTOCLEAR (1 << 19) /* erase me on expire */ +#define IAX_ENCRYPTED (1 << 12) /* Whether we should assume encrypted tx/rx */ +#define IAX_KEYPOPULATED (1 << 13) /* Whether we have a key populated */ +#define IAX_CODEC_USER_FIRST (1 << 14) /* are we willing to let the other guy choose the codec? */ +#define IAX_CODEC_NOPREFS (1 << 15) /* Force old behaviour by turning off prefs */ +#define IAX_CODEC_NOCAP (1 << 16) /* only consider requested format and ignore capabilities*/ +#define IAX_RTCACHEFRIENDS (1 << 17) /* let realtime stay till your reload */ +#define IAX_RTNOUPDATE (1 << 18) /* Don't send a realtime update */ +#define IAX_RTAUTOCLEAR (1 << 19) /* erase me on expire */ #define IAX_FORCEJITTERBUF (1 << 20) /* Force jitterbuffer, even when bridged to a channel that can take jitter */ static int global_rtautoclear = 120; @@ -261,7 +261,7 @@ struct iax2_peer { struct ast_codec_pref prefs; struct sockaddr_in addr; int formats; - int sockfd; /* Socket to use for transmission */ + int sockfd; /* Socket to use for transmission */ struct in_addr mask; unsigned int flags; diff --git a/cli.c b/cli.c index 683d37988..2ee83ab63 100755 --- a/cli.c +++ b/cli.c @@ -377,7 +377,7 @@ static int handle_modlist(int fd, int argc, char *argv[]) if (argc == 3) return RESULT_SHOWUSAGE; else if (argc >= 4) { - if ( strcmp(argv[2],"like") ) + if (strcmp(argv[2],"like")) return RESULT_SHOWUSAGE; like = argv[3]; } @@ -694,51 +694,52 @@ static int handle_showchan(int fd, int argc, char *argv[]) } else strncpy(cdrtime, "N/A", sizeof(cdrtime) -1); ast_cli(fd, - " -- General --\n" - " Name: %s\n" - " Type: %s\n" - " UniqueID: %s\n" - " Caller ID: %s\n" - " Caller ID Name: %s\n" - " DNID Digits: %s\n" - " State: %s (%d)\n" - " Rings: %d\n" - " NativeFormat: %d\n" - " WriteFormat: %d\n" - " ReadFormat: %d\n" - "1st File Descriptor: %d\n" - " Frames in: %d%s\n" - " Frames out: %d%s\n" - " Time to Hangup: %ld\n" - " Elapsed Time: %s\n" - " Direct Bridge: %s\n" - "Indirect Bridge: %s\n" - " -- PBX --\n" - " Context: %s\n" - " Extension: %s\n" - " Priority: %d\n" - " Call Group: %d\n" - " Pickup Group: %d\n" - " Application: %s\n" - " Data: %s\n" - " Blocking in: %s\n", - c->name, c->type, c->uniqueid, - (c->cid.cid_num ? c->cid.cid_num : "(N/A)"), - (c->cid.cid_name ? c->cid.cid_name : "(N/A)"), - (c->cid.cid_dnid ? c->cid.cid_dnid : "(N/A)" ), ast_state2str(c->_state), c->_state, c->rings, c->nativeformats, c->writeformat, c->readformat, - c->fds[0], c->fin & 0x7fffffff, (c->fin & 0x80000000) ? " (DEBUGGED)" : "", - c->fout & 0x7fffffff, (c->fout & 0x80000000) ? " (DEBUGGED)" : "", (long)c->whentohangup, - cdrtime, c->_bridge ? c->_bridge->name : "", ast_bridged_channel(c) ? ast_bridged_channel(c)->name : "", - c->context, c->exten, c->priority, c->callgroup, c->pickupgroup, ( c->appl ? c->appl : "(N/A)" ), - ( c-> data ? (!ast_strlen_zero(c->data) ? c->data : "(Empty)") : "(None)"), - (ast_test_flag(c, AST_FLAG_BLOCKING) ? c->blockproc : "(Not Blocking)")); - if(pbx_builtin_serialize_variables(c,buf,sizeof(buf))) - ast_cli(fd," Variables:\n%s\n",buf); - if(c->cdr && ast_cdr_serialize_variables(c->cdr,buf, sizeof(buf), '=', '\n', 1)) - ast_cli(fd," CDR Variables:\n%s\n",buf); + " -- General --\n" + " Name: %s\n" + " Type: %s\n" + " UniqueID: %s\n" + " Caller ID: %s\n" + " Caller ID Name: %s\n" + " DNID Digits: %s\n" + " State: %s (%d)\n" + " Rings: %d\n" + " NativeFormat: %d\n" + " WriteFormat: %d\n" + " ReadFormat: %d\n" + "1st File Descriptor: %d\n" + " Frames in: %d%s\n" + " Frames out: %d%s\n" + " Time to Hangup: %ld\n" + " Elapsed Time: %s\n" + " Direct Bridge: %s\n" + "Indirect Bridge: %s\n" + " -- PBX --\n" + " Context: %s\n" + " Extension: %s\n" + " Priority: %d\n" + " Call Group: %d\n" + " Pickup Group: %d\n" + " Application: %s\n" + " Data: %s\n" + " Blocking in: %s\n", + c->name, c->type, c->uniqueid, + (c->cid.cid_num ? c->cid.cid_num : "(N/A)"), + (c->cid.cid_name ? c->cid.cid_name : "(N/A)"), + (c->cid.cid_dnid ? c->cid.cid_dnid : "(N/A)" ), ast_state2str(c->_state), c->_state, c->rings, c->nativeformats, c->writeformat, c->readformat, + c->fds[0], c->fin & 0x7fffffff, (c->fin & 0x80000000) ? " (DEBUGGED)" : "", + c->fout & 0x7fffffff, (c->fout & 0x80000000) ? " (DEBUGGED)" : "", (long)c->whentohangup, + cdrtime, c->_bridge ? c->_bridge->name : "", ast_bridged_channel(c) ? ast_bridged_channel(c)->name : "", + c->context, c->exten, c->priority, c->callgroup, c->pickupgroup, ( c->appl ? c->appl : "(N/A)" ), + ( c-> data ? (!ast_strlen_zero(c->data) ? c->data : "(Empty)") : "(None)"), + (ast_test_flag(c, AST_FLAG_BLOCKING) ? c->blockproc : "(Not Blocking)")); + + if(pbx_builtin_serialize_variables(c,buf,sizeof(buf))) + ast_cli(fd," Variables:\n%s\n",buf); + if(c->cdr && ast_cdr_serialize_variables(c->cdr,buf, sizeof(buf), '=', '\n', 1)) + ast_cli(fd," CDR Variables:\n%s\n",buf); ast_mutex_unlock(&c->lock); - break; + break; } ast_mutex_unlock(&c->lock); c = ast_channel_walk_locked(c); diff --git a/doc/README.variables b/doc/README.variables index d923ece7b..fb2f4db25 100755 --- a/doc/README.variables +++ b/doc/README.variables @@ -297,109 +297,103 @@ Variables marked with a * are builtin functions and can't be set, only read in the dialplan. Writes to such variables are silently ignored. -${ACCOUNTCODE} * Account code (if specified) -${BLINDTRANSFER} The name of the channel on the other side a blind transfer -${BRIDGEPEER} Bridged peer -${CALLERANI} * Caller ANI (PRI channels) -${CALLERID} * Caller ID -${CALLERIDNAME} * Caller ID Name only -${CALLERIDNUM} * Caller ID Number only -${CALLINGANI2} * Caller ANI2 (PRI channels) -${CALLINGPRES} * Caller ID presentation for incoming calls (PRI channels) -${CALLINGTNS} * Transit Network Selector (PRI channels) -${CALLINGTON} * Caller Type of Number (PRI channels) -${CHANNEL} * Current channel name -${CONTEXT} * Current context -${DATETIME} * Current date time in the format: YYYY-MM-DD_HH:MM:SS -${DNID} * Dialed Number Identifier -${EPOCH} * Current unix style epoch -${EXTEN} * Current extension -${ENV(VAR)} * Environmental variable VAR -${HANGUPCAUSE} * Asterisk cause of hangup (inbound/outbound) -${HINT} * Channel hints for this extension -${HINTNAME} * Suggested Caller*ID name for this extension -${INVALID_EXTEN} The invalid called extension (used in the "i" extension) -${LANGUAGE} * Current language -${LEN(VAR)} * String length of VAR (integer) -${PRIORITY} * Current priority in the dialplan -${PRIREDIRECTREASON} Reason for redirect on PRI, if a call was directed -${RDNIS} * Redirected Dial Number ID Service -${TIMESTAMP} * Current date time in the format: YYYYMMDD-HHMMSS -${TRANSFER_CONTEXT} Context for transferred calls -${UNIQUEID} * Current call unique identifier +${ACCOUNTCODE} * Account code (if specified) +${BLINDTRANSFER} The name of the channel on the other side a blind transfer +${BRIDGEPEER} Bridged peer +${CALLERANI} * Caller ANI (PRI channels) +${CALLERID} * Caller ID +${CALLERIDNAME} * Caller ID Name only +${CALLERIDNUM} * Caller ID Number only +${CALLINGANI2} * Caller ANI2 (PRI channels) +${CALLINGPRES} * Caller ID presentation for incoming calls (PRI channels) +${CALLINGTNS} * Transit Network Selector (PRI channels) +${CALLINGTON} * Caller Type of Number (PRI channels) +${CHANNEL} * Current channel name +${CONTEXT} * Current context +${DATETIME} * Current date time in the format: YYYY-MM-DD_HH:MM:SS +${DNID} * Dialed Number Identifier +${EPOCH} * Current unix style epoch +${EXTEN} * Current extension +${ENV(VAR)} * Environmental variable VAR +${HANGUPCAUSE} * Asterisk cause of hangup (inbound/outbound) +${HINT} * Channel hints for this extension +${HINTNAME} * Suggested Caller*ID name for this extension +${INVALID_EXTEN} The invalid called extension (used in the "i" extension) +${LANGUAGE} * Current language +${LEN(VAR)} * String length of VAR (integer) +${PRIORITY} * Current priority in the dialplan +${PRIREDIRECTREASON} Reason for redirect on PRI, if a call was directed +${RDNIS} * Redirected Dial Number ID Service +${TIMESTAMP} * Current date time in the format: YYYYMMDD-HHMMSS +${TRANSFER_CONTEXT} Context for transferred calls +${UNIQUEID} * Current call unique identifier Various application variables ----------------------------- -${CURL} Resulting page content for curl() -${ENUM} Result of application EnumLookup -${EXITCONTEXT} Context to exit to in IVR menu (app background()) - or in the RetryDial() application -${GROUPCOUNT} Result from groupcount() -${MONITOR} Set to "TRUE" if the channel is/has been monitored (app monitor()) -${MONITOR_EXEC} Application to execute after monitoring a call +${CURL} * Resulting page content for curl() +${ENUM} * Result of application EnumLookup +${EXITCONTEXT} Context to exit to in IVR menu (app background()) + or in the RetryDial() application +${GROUPCOUNT} * Result from groupcount() +${MONITOR} * Set to "TRUE" if the channel is/has been monitored (app monitor()) +${MONITOR_EXEC} Application to execute after monitoring a call ${MONITOR_EXEC_ARGS} Arguments to application -${MONITOR_FILENAME} File for monitoring (recording) calls in queue -${QUEUE_PRIO} Queue priority -${RECORDED_FILE} Recorded file in record() -${TALK_DETECED} Result from talkdetect() -${TOUCH_MONITOR} The filename base to use with Touch Monitor (auto record) -${TXTCIDNAME} Result of application TXTCIDName -${VPB_GETDTMF} chan_vpb +${MONITOR_FILENAME} File for monitoring (recording) calls in queue +${QUEUE_PRIO} Queue priority +${RECORDED_FILE} * Recorded file in record() +${TALK_DETECED} * Result from talkdetect() +${TOUCH_MONITOR} The filename base to use with Touch Monitor (auto record) +${TXTCIDNAME} * Result of application TXTCIDName +${VPB_GETDTMF} chan_vpb The MeetMe Conference Bridge uses the following variables: ---------------------------------------------------------- -${MEETME_RECORDINGFILE} Name of file for recording a conference with - the "r" option -${MEETME_RECORDINGFORMAT} Format of file to be recorded -${MEETME_EXIT_CONTEXT} Context for exit out of meetme meeting -${MEETME_AGI_BACKGROUND} AGI script for Meetme (zap only) - -Meetme() sets the following variable: -${MEETMESECS} Number of seconds a user participated in a MeetMe conference +${MEETME_RECORDINGFILE} Name of file for recording a conference with + the "r" option +${MEETME_RECORDINGFORMAT} Format of file to be recorded +${MEETME_EXIT_CONTEXT} Context for exit out of meetme meeting +${MEETME_AGI_BACKGROUND} AGI script for Meetme (zap only) +${MEETMESECS} * Number of seconds a user participated in a MeetMe conference The voicemail() application uses the following variables: --------------------------------------------------------- ${VM_CATEGORY} Sets voicemail category +${VM_NAME} * Full name in voicemail +${VM_DUR} * Voicemail duration +${VM_MSGNUM} * Number of voicemail message in mailbox +${VM_CALLERID} * Voicemail Caller ID (Person leaving vm) +${VM_CIDNAME} * Voicemail Caller ID Name +${VM_CIDNUM} * Voicemail Caller ID Number +${VM_DATE} * Voicemail Date -The following variables are set by voicemail() -${VM_NAME} Full name in voicemail -${VM_DUR} Voicemail duration -${VM_MSGNUM} Number of voicemail message in mailbox -${VM_CALLERID} Voicemail Caller ID (Person leaving vm) -${VM_CIDNAME} Voicemail Caller ID Name -${VM_CIDNUM} Voicemail Caller ID Number -${VM_DATE} Voicemail Date - -The following variables are set by vmauthenticate() -${AUTH_MAILBOX} Authenticated mailbox -${AUTH_CONTEXT} Authenticated mailbox context -${DIFF_DAY} Day difference (internal use) - -Dundi() uses the following variables +The vmauthenticate() application uses the following variables: --------------------------------------------------------- -${DUNDTECH} Technology -${DUNDDEST} Destination +${AUTH_MAILBOX} * Authenticated mailbox +${AUTH_CONTEXT} * Authenticated mailbox context + +DUNDiLookup() uses the following variables +--------------------------------------------------------- +${DUNDTECH} * The Technology of the result from a call to DUNDiLookup() +${DUNDDEST} * The Destination of the result from a call to DUNDiLookup() The Zaptel channel sets the following variables: --------------------------------------------------------- -${ANI2} The ANI2 Code provided by the network on the incoming call. +${ANI2} * The ANI2 Code provided by the network on the incoming call. (ie, Code 29 identifies call as a Prison/Inmate Call) -${CALLTYPE} Type of call (Speech, Digital, etc) -${CALLEDTON} Type of number for incoming PRI extension +${CALLTYPE} * Type of call (Speech, Digital, etc) +${CALLEDTON} * Type of number for incoming PRI extension i.e. 0=unknown, 1=international, 2=domestic, 3=net_specific, 4=subscriber, 6=abbreviated, 7=reserved -${CALLINGSUBADDR} Called PRI Subaddress -${FAXEXTEN} The extension called before being redirected to "fax" -${PRIREDIRECTREASON} Reason for redirect, if a call was directed +${CALLINGSUBADDR} * Called PRI Subaddress +${FAXEXTEN} * The extension called before being redirected to "fax" +${PRIREDIRECTREASON} * Reason for redirect, if a call was directed The SIP channel sets the following variables: --------------------------------------------------------- -${SIPCALLID} SIP Call-ID: header verbatim (for logging or CDR matching) -${SIPDOMAIN} SIP destination domain of an inbound call (if appropriate) -${SIPUSERAGENT} SIP user agent -${SIPURI} SIP uri - -The SIP channel reads the following variable: +${SIPCALLID} * SIP Call-ID: header verbatim (for logging or CDR matching) +${SIPDOMAIN} * SIP destination domain of an inbound call (if appropriate) +${SIPUSERAGENT} * SIP user agent +${SIPURI} * SIP uri ${SIP_CODEC} Set the SIP codec for a call The Agent channel uses the following variables: @@ -410,41 +404,37 @@ ${AGENTGOODBYE} Sound file to use for "Good Bye" when agent logs out ${AGENTACKCALL} Whether the agent should acknowledge the incoming call ${AGENTAUTOLOGOFF} Auto logging off for an agent ${AGENTWRAPUPTIME} Setting the time for wrapup between incoming calls -${AGENTNUMBER} Agent number (username) set at login -${AGENTSTATUS} Status of login ( fail | on | off ) -${AGENTEXTEN} Extension for logged in agent +${AGENTNUMBER} * Agent number (username) set at login +${AGENTSTATUS} * Status of login ( fail | on | off ) +${AGENTEXTEN} * Extension for logged in agent -The Dial() application sets the following variables: +The Dial() application uses the following variables: --------------------------------------------------------- -${DIALEDPEERNAME} Dialed peer name -${DIALEDPEERNUMBER} Dialed peer number -${DIALEDTIME} Time for the call (seconds) -${ANSWEREDTIME} Time from dial to answer (seconds) -${DIALSTATUS} Status of the call, one of: - CHANUNAVAIL | CONGESTION | BUSY | NOANSWER | ANSWER | CANCEL - -The dial() application reads the following variables +${DIALEDPEERNAME} * Dialed peer name +${DIALEDPEERNUMBER} * Dialed peer number +${DIALEDTIME} * Time for the call (seconds) +${ANSWEREDTIME} * Time from dial to answer (seconds) +${DIALSTATUS} * Status of the call, one of: + (CHANUNAVAIL | CONGESTION | BUSY | NOANSWER | ANSWER | CANCEL) ${LIMIT_PLAYAUDIO_CALLER} Soundfile for call limits ${LIMIT_PLAYAUDIO_CALLEE} Soundfile for call limits ${LIMIT_WARNING_FILE} Soundfile for call limits ${LIMIT_TIMEOUT_FILE} Soundfile for call limits ${LIMIT_CONNECT_FILE} Soundfile for call limits -${OUTBOUND_GROUP} Default groups for peer channels (as in SetGroup) +${OUTBOUND_GROUP} Default groups for peer channels (as in SetGroup) * See "show application dial" for more information - - The chanisavail() application sets the following variables: ----------------------------------------------------------- -${AVAILCHAN} return value -${AVAILORIGCHAN} return value -${AVAILSTATUS} Status of requested channel +${AVAILCHAN} * the name of the available channel if one was found +${AVAILORIGCHAN} * the canonical channel name that was used to create the channel +${AVAILSTATUS} * Status of requested channel When using macros in the dialplan, these variables are available --------------------------------------------------------- -${MACRO_EXTEN} The calling extensions -${MACRO_CONTEXT} The calling context -${MACRO_PRIORITY} The calling priority +${MACRO_EXTEN} * The calling extensions +${MACRO_CONTEXT} * The calling context +${MACRO_PRIORITY} * The calling priority ${MACRO_OFFSET} Offset to add to priority at return from macro If you compile with OSP support in the SIP channel, these diff --git a/manager.c b/manager.c index 0d3d5e82e..58953dcd4 100755 --- a/manager.c +++ b/manager.c @@ -1343,7 +1343,7 @@ static void *accept_thread(void *ignore) continue; } p = getprotobyname("tcp"); - if( p ) { + if (p) { if( setsockopt(as, p->p_proto, TCP_NODELAY, (char *)&arg, sizeof(arg) ) < 0 ) { ast_log(LOG_WARNING, "Failed to set manager tcp connection to TCP_NODELAY mode: %s\n", strerror(errno)); } diff --git a/res/res_odbc.c b/res/res_odbc.c index 40cda2750..c8408177b 100755 --- a/res/res_odbc.c +++ b/res/res_odbc.c @@ -92,7 +92,7 @@ int odbc_smart_execute(odbc_obj *obj, SQLHSTMT stmt) obj->up = 0; ast_mutex_unlock(&obj->lock); odbc_obj_disconnect(obj); - odbc_obj_connect(obj); + odbc_obj_connect(obj); res = SQLExecute(stmt); } @@ -111,7 +111,7 @@ int odbc_smart_direct_execute(odbc_obj *obj, SQLHSTMT stmt, char *sql) obj->up = 0; ast_mutex_unlock(&obj->lock); odbc_obj_disconnect(obj); - odbc_obj_connect(obj); + odbc_obj_connect(obj); res = SQLExecDirect (stmt, sql, SQL_NTS); }