[asterisk-dev] Default Device State (devicestate.c)

Joshua C. Colp jcolp at sangoma.com
Fri Aug 19 13:26:12 CDT 2022

On Fri, Aug 19, 2022 at 3:11 PM Bill Kervaski <bill at kervaski.com> wrote:

> Hi All!
> Hacking around in devicestate.c (18.14.0) I can change the following to
> get the default device state to “NOT_INUSE”.
> Wondering if this is a reasonable way to handle this, as my requirement is
> for all "UNKNOWN" device states to be treated as “NOT_INUSE” without having
> to invoke a call or an AMI action to set the initial state.
> Not knowing what this may impact makes me hesitant to put this into
> production without someone who knows this subsystem’s blessing, any advice
> appreciated!
> enum ast_device_state ast_devstate_val(const char *val)
> {
>         if (!strcasecmp(val, "NOT_INUSE"))
>                 return AST_DEVICE_NOT_INUSE;
>         else if (!strcasecmp(val, "INUSE"))
>                 return AST_DEVICE_INUSE;
>         else if (!strcasecmp(val, "BUSY"))
>                 return AST_DEVICE_BUSY;
>         else if (!strcasecmp(val, "INVALID"))
>                 return AST_DEVICE_INVALID;
>         else if (!strcasecmp(val, "UNAVAILABLE"))
>                 return AST_DEVICE_UNAVAILABLE;
>         else if (!strcasecmp(val, "RINGING"))
>                 return AST_DEVICE_RINGING;
>         else if (!strcasecmp(val, "RINGINUSE"))
>                 return AST_DEVICE_RINGINUSE;
>         else if (!strcasecmp(val, "ONHOLD"))
>                 return AST_DEVICE_ONHOLD;
>         return AST_DEVICE_NOT_INUSE; // MY CHANGE
>         // return AST_DEVICE_UNKNOWN;
> }

I don't think anyone will really give a blessing on this since it's a
fundamental change. It's an unknown as to the true impact.

Joshua C. Colp
Asterisk Project Lead
Sangoma Technologies
Check us out at www.sangoma.com and www.asterisk.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20220819/83fa97d3/attachment.html>

More information about the asterisk-dev mailing list