Merge "chan_sip: option 'notifyringing' change and doc fix"
[asterisk/asterisk.git] / channels / chan_sip.c
index b4c2602..9e87027 100644 (file)
@@ -14655,7 +14655,7 @@ static void state_notify_build_xml(struct state_notify_data *data, int full, con
 
        switch (data->state) {
        case (AST_EXTENSION_RINGING | AST_EXTENSION_INUSE):
-               statestring = (sip_cfg.notifyringing) ? "early" : "confirmed";
+               statestring = (sip_cfg.notifyringing == NOTIFYRINGING_ENABLED) ? "early" : "confirmed";
                local_state = NOTIFY_INUSE;
                pidfstate = "busy";
                pidfnote = "Ringing";
@@ -21193,7 +21193,7 @@ static char *sip_show_settings(struct ast_cli_entry *e, int cmd, struct ast_cli_
        ast_cli(a->fd, "  Outbound reg. timeout:  %d secs\n", global_reg_timeout);
        ast_cli(a->fd, "  Outbound reg. attempts: %d\n", global_regattempts_max);
        ast_cli(a->fd, "  Outbound reg. retry 403:%d\n", global_reg_retry_403);
-       ast_cli(a->fd, "  Notify ringing state:   %s\n", AST_CLI_YESNO(sip_cfg.notifyringing));
+       ast_cli(a->fd, "  Notify ringing state:   %s%s\n", AST_CLI_YESNO(sip_cfg.notifyringing), sip_cfg.notifyringing == NOTIFYRINGING_NOTINUSE ? " (when not in use)" : "");
        if (sip_cfg.notifyringing) {
                ast_cli(a->fd, "    Include CID:          %s%s\n",
                                AST_CLI_YESNO(sip_cfg.notifycid),
@@ -31740,7 +31740,11 @@ static int reload_config(enum channelreloadreason reason)
                } else if (!strcasecmp(v->name, "directrtpsetup")) {
                        sip_cfg.directrtpsetup = ast_true(v->value);
                } else if (!strcasecmp(v->name, "notifyringing")) {
-                       sip_cfg.notifyringing = ast_true(v->value);
+                       if (!strcasecmp(v->value, "notinuse")) {
+                               sip_cfg.notifyringing = NOTIFYRINGING_NOTINUSE;
+                       } else {
+                               sip_cfg.notifyringing = ast_true(v->value) ? NOTIFYRINGING_ENABLED : NOTIFYRINGING_DISABLED;
+                       }
                } else if (!strcasecmp(v->name, "notifyhold")) {
                        sip_cfg.notifyhold = ast_true(v->value);
                } else if (!strcasecmp(v->name, "notifycid")) {