mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-02 11:58:40 +00:00
devicestate.c: Minor tweaks
* In ast_state_chan2dev() use ARRAY_LEN() instead of a sentinel value in chan2dev[]. * Fix some comments in chan_iax2.c. ........ Merged revisions 422661 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@422663 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -5036,7 +5036,7 @@ reject:
|
||||
* password field will be set to NULL.
|
||||
*
|
||||
* \note The dial string format is:
|
||||
* [username[:password]@]peer[:port][/exten[@@context]][/options]
|
||||
* [username[:password]@]peer[:port][/exten[@context]][/options]
|
||||
*/
|
||||
static void parse_dial_string(char *data, struct parsed_dial_string *pds)
|
||||
{
|
||||
@@ -5069,9 +5069,10 @@ static void parse_dial_string(char *data, struct parsed_dial_string *pds)
|
||||
pds->peer = strsep(&data, ":");
|
||||
pds->port = data;
|
||||
|
||||
/* check for a key name wrapped in [] in the secret position, if found,
|
||||
move it to the key field instead
|
||||
*/
|
||||
/*
|
||||
* Check for a key name wrapped in [] in the password position.
|
||||
* If found, move it to the key field instead.
|
||||
*/
|
||||
if (pds->password && (pds->password[0] == '[')) {
|
||||
pds->key = ast_strip_quoted(pds->password, "[", "]");
|
||||
pds->password = NULL;
|
||||
|
||||
@@ -169,7 +169,7 @@ static const char * const devstatestring[][2] = {
|
||||
{ /* 5 AST_DEVICE_UNAVAILABLE */ "Unavailable", "UNAVAILABLE" }, /*!< Unavailable (not registered) */
|
||||
{ /* 6 AST_DEVICE_RINGING */ "Ringing", "RINGING" }, /*!< Ring, ring, ring */
|
||||
{ /* 7 AST_DEVICE_RINGINUSE */ "Ring+Inuse", "RINGINUSE" }, /*!< Ring and in use */
|
||||
{ /* 8 AST_DEVICE_ONHOLD */ "On Hold", "ONHOLD" }, /*!< On Hold */
|
||||
{ /* 8 AST_DEVICE_ONHOLD */ "On Hold", "ONHOLD" }, /*!< On Hold */
|
||||
};
|
||||
|
||||
/*!\brief Mapping for channel states to device states */
|
||||
@@ -187,7 +187,6 @@ static const struct chan2dev {
|
||||
{ AST_STATE_BUSY, AST_DEVICE_BUSY },
|
||||
{ AST_STATE_DIALING_OFFHOOK, AST_DEVICE_INUSE },
|
||||
{ AST_STATE_PRERING, AST_DEVICE_RINGING },
|
||||
{ -100, -100 },
|
||||
};
|
||||
|
||||
/*! \brief A device state provider (not a channel) */
|
||||
@@ -251,7 +250,7 @@ enum ast_device_state ast_state_chan2dev(enum ast_channel_state chanstate)
|
||||
{
|
||||
int i;
|
||||
chanstate &= 0xFFFF;
|
||||
for (i = 0; chan2dev[i].chan != -100; i++) {
|
||||
for (i = 0; i < ARRAY_LEN(chan2dev); i++) {
|
||||
if (chan2dev[i].chan == chanstate) {
|
||||
return chan2dev[i].dev;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user