Generate context for adding callerid name with proper sequences.
authorMichael Geddes <openwrt@frog.wheelycreek.net>
Sat, 17 Jan 2009 12:22:46 +0000 (12:22 +0000)
committerMichael Geddes <openwrt@frog.wheelycreek.net>
Sat, 17 Jan 2009 12:22:46 +0000 (12:22 +0000)
contrib/package/asterisk-xip/files/uci/sipiaxconf

index 6074086d1702232cc23f3100f9736098b9b7898a..ab2e8fc47da4f3085186a0f2c2fbb46b3cf6f9e6 100755 (executable)
@@ -44,12 +44,16 @@ append_dialplan_locals(){
                        # add_dialplan_include ${newcontext}  ${x_last_context}
 
                        append_dialplan_context ${newcontext} "exten => ${match_all},1,Set(CALLERID(num)=${extension})"
-                       [ -z "${x_displayname}" ] || append_dialplan_context ${newcontext} "exten => ${match_all},1,Set(CALLERID(name)=${x_displayname})"
+                       local next=2
+                       if [ ! -z "${x_displayname}" ] ; then
+                               append_dialplan_context ${newcontext} "exten => ${match_all},2,Set(CALLERID(name)=${x_displayname})"
+                               local next=3
+                       fi
                        if [ ! -z "${x_mailbox}" ] ; then
-                               [ "${x_selfmailbox}" = "yes" ] && append_dialplan_context ${newcontext} "exten => ${extension},2,VoiceMailMain(${x_mailbox})"
-                               [ ! -z "${dialplan_voiceboxext}" ]  && append_dialplan_context ${newcontext} "exten => ${dialplan_voiceboxext},2,VoiceMailMain(${x_mailbox})"
+                               [ "${x_selfmailbox}" = "yes" ] && append_dialplan_context ${newcontext} "exten => ${extension},${next},VoiceMailMain(${x_mailbox})"
+                               [ ! -z "${dialplan_voiceboxext}" ]  && append_dialplan_context ${newcontext} "exten => ${dialplan_voiceboxext},${next},VoiceMailMain(${x_mailbox})"
                        fi
-                       append_dialplan_context ${newcontext} "exten => ${match_all},2,Goto(${x_context},\${EXTEN},1)"
+                       append_dialplan_context ${newcontext} "exten => ${match_all},${next},Goto(${x_context},\${EXTEN},1)"
                fi
        done
 }