← Back to team overview

wikipbx-dev team mailing list archive

[RFC] Add ability to filter dialing extensions by caller id number

 

Hello,

i think it would be handy to be able to have extensions that can be dialed only by some caller id number. What do you think?

You need to add a callerid_num to wikipbxweb_extension:

alter table "wikipbxweb_extension" add column "callerid_num" varchar(75);

BTW, when we are adding south as dependency? :)

thanks,
riccardo
=== modified file 'wikipbx/freeswitchxml/dialplan.xml'
--- wikipbx/freeswitchxml/dialplan.xml	2010-09-07 09:45:06 +0000
+++ wikipbx/freeswitchxml/dialplan.xml	2010-10-21 07:15:08 +0000
@@ -3,6 +3,9 @@
 
 <context name='{{ call_context }}'>
   <extension name='dynamic_wikipbx_extension'>
+    {% if extension.callerid_num %}
+    <condition field='caller_id_number' expression='{{ extension.callerid_num }}'/>
+    {% endif %}
     <condition field='destination_number'>
       <action application='set' data='account_id={{ extension.account.id }}'/>
       <action application='set' data='extension_id={{ extension.id }}'/>

=== modified file 'wikipbx/wikipbxweb/forms.py'
--- wikipbx/wikipbxweb/forms.py	2010-09-15 12:27:56 +0000
+++ wikipbx/wikipbxweb/forms.py	2010-10-20 15:55:19 +0000
@@ -122,7 +122,7 @@
         
     class Meta:
         model = models.Extension
-        fields = 'dest_num', 'desc', 'auth_call'
+        fields = 'dest_num', 'callerid_num', 'desc', 'auth_call'
 
 
 class ActionForm(forms.Form):

=== modified file 'wikipbx/wikipbxweb/models.py'
--- wikipbx/wikipbxweb/models.py	2010-10-02 11:29:10 +0000
+++ wikipbx/wikipbxweb/models.py	2010-10-20 16:01:07 +0000
@@ -391,6 +391,12 @@
             u"A perl compatible regex expression used to match against "
             "the destination number, eg: ^101$ to match 101,"
             "^(\d{10,11})$ to match all 10 or 11 digit numbers"))
+    callerid_num = models.CharField(
+        _(u"callerid ID number"), max_length=75, blank=True, null=True,
+        help_text=_(
+            u"A perl compatible regex expression used to match against "
+            "the caller id number, eg: ^101$ to match 101,"
+            "^(\d{10,11})$ to match all 10 or 11 digit numbers"))
     desc = models.CharField(_(u"description"), max_length=250, blank=True)
 
     # the actions in a malformed rootless xml snippet:


Follow ups