Add DisplayName option to sip/iax for callerid display
authorMichael Geddes <openwrt@frog.wheelycreek.net>
Sat, 17 Jan 2009 11:07:52 +0000 (11:07 +0000)
committerMichael Geddes <openwrt@frog.wheelycreek.net>
Sat, 17 Jan 2009 11:07:52 +0000 (11:07 +0000)
contrib/package/asterisk-xip/files/uci/sipiaxconf
contrib/package/asterisk-xip/files/uci/sipiaxconf.txt

index 30af55e56c700f5cf845402017d3d1e86c47b99f..6074086d1702232cc23f3100f9736098b9b7898a 100755 (executable)
@@ -23,6 +23,7 @@ check_append_local() {
                eval  "dialplan_local_${1}_context=\"${2}\""
                eval  "dialplan_local_${1}_selfmailbox=\"${3}\""
                eval  "dialplan_local_${1}_mailbox=\"${4}\""
+               eval  "dialplan_local_${1}_displayname=\"${5}\""
                return 0
        else
                return 1
@@ -31,7 +32,7 @@ check_append_local() {
 append_dialplan_locals(){
        for i in ${dialplan_locals} ; do
                local extension=$i
-               for x in context selfmailbox mailbox ; do
+               for x in context selfmailbox mailbox displayname ; do
                        eval "x_${x}=\${dialplan_local_${i}_${x}}"
                done
                local newcontext=local_${extension}
@@ -43,6 +44,7 @@ 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})"
                        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})"
@@ -72,14 +74,14 @@ check_add_iaxitems() {
 
 do_check_add_items(){
 
-       for i in type last_host last_context selfmailbox last_extension last_mailbox ; do
+       for i in type last_host last_context selfmailbox last_extension last_mailbox last_displayname ; do
                eval "x_${i}=\"\${${1}_${i}-}\""
        done
 
        if [ ! -z "${x_last_context}" ] ; then
                if [ ! -z "${x_last_extension}" ] ; then
                        [ "${x_last_context}" = "-" ] && eval "x_last_context=\"\${${1}_opt_context}\""
-                       check_append_local "${x_last_extension}" "${x_last_context}" "${x_selfmailbox}" "${x_last_mailbox}"
+                       check_append_local "${x_last_extension}" "${x_last_context}" "${x_selfmailbox}" "${x_last_mailbox}" "${x_last_displayname}"
                        x_last_context=local_${x_last_extension}
                fi
                if [ "${x_last_context}" != "-" ] ; then
@@ -91,7 +93,8 @@ do_check_add_items(){
        fi
 
        for i in last_username last_fromdomain last_secret last_username \
-               sectionname last_fromuser last_context last_extension last_mailbox last_type last_host ; do
+               sectionname last_fromuser last_context last_extension last_mailbox \
+               last_type last_host last_displayname ; do
                eval unset $1_$i
        done
 
@@ -337,7 +340,7 @@ handle_sip() {
                                append sip_sections "$1=$2" "$N"
                                ;;
                        register) [ "$2" == "yes" ] && sip_doregister=1 ;;
-                       registerextension) eval sip_last_$1="$2";;
+                       registerextension|displayname) eval sip_last_$1="$2";;
                        allow|allow_ITEM*) split_append sip_sections allow= "$2" "${N}" enable_format ;;
                        extension|extension_ITEM*)    add_extension SIP ${sip_sectionname} "$2" ;;
 
@@ -460,6 +463,7 @@ handle_iax() {
                                split_append iax_sections allow= "$2" "${N}" enable_format ;;
                        extension_LENGTH) ;;
                        extension|extension_ITEM*)    add_extension IAX ${iax_sectionname} "$2" ;;
+                       displayname) eval iax_last_$1="$2";;
                        context)
                                eval iax_last_context="$2" ;;
                        selfmailbox)
index 64883515f31be9ffd131b97028a535b236dba8ba..8e166595bb694ae9f1fdb111e04400137d47f35c 100644 (file)
@@ -5,6 +5,7 @@ target (SIP|IAX)_{name}  - Handle options for outgoing dialing
        internationalprefix- Prefix required to dial internation on this target
        alwaysinternational- True if this target always requires internation prefix
        countrycode        - Default International country code for this target
+       displayname        - CallerID Name to set.
 
 sipgeneral
 sip [sip_]{name}