Jump to content

cf_dynamic_cid - Can someone post an example of a working call flow using this module on hosted?


Recommended Posts

Posted
I am trying to get this to work.  Here is some info:
https://github.com/2600hz/kazoo/blob/master/applications/callflow/doc/cf_dynamic_cid.md

I have tried posting a call flow like below but I may have mangled it some how.

{    "data":{
        "name": "dynamic_cid_outbound",
        "numbers": [],
        "patterns":["^\\*9([0-9]{2,})$"],
            "flow":{
"module": "dynamic_cid"
,"data": {
    "_id": "cidlist",
    "length" : 2,
    "entries": {
       "00": {
           "number": "15173335555",
           "name": "COMPANY NAME"
       },
       "01": {
           "number": "15175553333",
           "name": "NAME COMPANY"
        }
    }
}
            }
   }
}

In this example I dial *900 + the 10 or 11 digit phone number and the dynamic_cid module is still asking me for the caller id to use.  If I enter one it ends up failing.

Is anyone using dynamic_cid in a call flow?  Can you sanitize and post a working example I can hack/tweak?
Posted
Are we allowed to post lists in hosted?

http://api.zswitch.net:8000/v2/accounts/{ACCOUNT_ID}/lists

{     "data":{  
      "name":"Dynamic CID",
      "description":"List of new callerid name and number entries ",
      "list_type":"dynamic_cid"
   }
}

I get:

{  "data": {
    "message": "not found"
  },
  "error": "404",
  "message": "not_found",
  "status": "error",
  "request_id": "sanitized",
  "auth_token": "value"
}
Guest CBV David
Posted
I heard this vaguely mentioned during the webinar, was there any answer for using this currently on the shared hosted SaaS environment?
Posted
The answer was that the ability to post lists in the SaaS environment is turned off.  However, it sounds like they are considering something.

It was also suggested that the feature I was talking about might have been a community submitted module.  However, when I look at the link I posted originally:

https://github.com/2600hz/kazoo/blob/master/applications/callflow/doc/cf_dynamic_cid.md

I thought it looked like standard functionality of the Dynamic CID module and not a community submission.  In any case, I wanted to try getting the list examples in the bottom of the above article to work.  Without being able to posts lists to Couch I suspect we will not be able to do this.
Guest CBV David
Posted
Well, that certainly explains why I didn't remember what the solution was. :P  Thanks for the quick response!

Even without using list documents, I hadn't been able to get the dynamic_cid callflow module to work properly in previous tests, but it's been awhile since I've taken a look at it.

Curious if I just had a formatting error or if the functionality isn't present in the environment at all.
Posted
Please do post an update if you try this again, without the list documents.  As I am only a hack programmer I would like to see a working example of using this, even if it means you have to attach the list as a child of the call flow and not store it in the database.
  • 4 years later...
Posted

Hello,

 

i try to use the Dynamic CID on Callflow. I don't have access in the APP Exchange. Only see this one in Callflow. But when i create a call flow, it only ask me to enter the identity of caller follow by #. But all i enter is good.

 

How to adapt the code beloww in a PIVOT for example to a PHP file.?

 

Tks The goal is to select one af my 8 numbers in my account to make a call out.

Posted

Hello thanks for your reply :-)

 

I have see this page but i'm a very NEWBIE :-(

 

I don't understand how exactly put all this code in a PHP file :-(

 

I understand what to put in the pivot to linking to the php file i want.

 

What i search is the caller choose the outcall number of the society.

 

Exemple: Society A = Number 3221231212

Society B = Number 3229879898

I create callflow with pivot for example with number "2003"

 

How to make the correct php file with code Json Inside to choose the society to make the calloutput.... Sorry for my poor english.

I see exemple of make *2(Futurecode i don't have in my smartPBX :-(  ) Then choose for exemple 01 (For Society A) then the number of the person i want to join. (Here in Belgium it's like 32(Code of Country) 2(Prefix of Bruxelles) xxx xx xx.

I want this if i want Society A.

 

*201322xxxxxxx

 

Thanks for your help :-)

Posted (edited)

First Pivot Script:

 

<?php

header('content-type:application/json');

?>

{
    "module":"tts",
    "data":{
        "text": "Please select your Provider and CallerID",
	"engine": "flite"
    },
    "children": {
        "_": {
            "module": "collect_dtmf",
            "data": {
                "max_digits": 3,
                "collection_name": "custom_name"
            },
            "children": {
                "_": {
                    "module": "pivot",
                    "data": {
			"voice_url": "http://portal.example.com/pivot/resource-cid-select.php"
                    },
                    "children": {}
                }
            }
        }
    }
}

Second Pivot Script:

<?php


function signalwire($digitspl) {
$signalwire = array("1631XXXXXXX", "1786XXXXXXX", "+1929XXXXXXX", "1848XXXXXXX", "1716XXXXXXX");
$calleeid = '+' .  $_REQUEST['To'];
header('content-type:application/json');
?>
{
                    "module": "dynamic_cid",
                    "data": {
			"action": "static",
			"caller_id" : {
				"name": "<?= $signalwire[$digitspl];   ?>",
				"number": "<?= $signalwire[$digitspl];   ?>"
				}
                    },
		    "children": {
			"_": {
				"module":"resources",
				"data": {
					"use_local_resources": false ,
					"outbound_flags": [ "signalwire" ],
					"to_did": "<?=  $calleeid     ?>"
					},
					"children": {}

				}


			}
                }
<?php
}

function bulkvs($digitspl) {
$bulkvs = array("1929XXXXXXX", "+1561XXXXXXX", "1786XXXXXXX", "1862XXXXXXXX");
header('content-type:application/json');

?>
{
                    "module": "dynamic_cid",
                    "data": {
			"action": "static",
			"caller_id" : {
				"name": "<?= $bulkvs[$digitspl];   ?>",
				"number": "<?= $bulkvs[$digitspl];   ?>"
				}
                    },
		    "children": {
			"_": {
				"module":"resources",
				"data": {
					"use_local_resources": false ,
					"outbound_flags": ["bulkvs"],
					"to_did": "<?=  $calleeid ;    ?>"
					},
					"children": {}

				}


			}
                }
<?php
}




$digitsel = $_REQUEST['Digits'];
$digitspl = $digitsel['custom_name'];

if($digitspl['0'] === '1' ){
signalwire($digitspl['1']);
}
elseif($digitspl['0'] === '2') {
bulkvs($digitspl['1']) ;
}
else {
$calleeid = '+' .  $_REQUEST['To'];
header('content-type:application/json');
?>
   {
                                "module":"resources",
                                "data": {
                                        "use_local_resources": false ,
                                        "to_did": "<?=  $digitspl    ?>"
                                        },
                                        "children": {}

                                }
	
	}
<?php
}

 

These pivot scripts can help as a quick method. For example, if you dial 12, it would choose the  assigned provider as first digit and the third callerid as the second one.

First digit:

> 1. 'Signalwire' < 

2. Bulkvs

Second digit:

1.  1631XXXXXXX

2. 1786XXXXXXX

> 3.  '1929XXXXXXX' < 

 

Edited by fmateo05
Update Script Formats for easy identification (see edit history)
Posted

Hello,

 

waouuuuu :-)

 

Thank you very much. I will try all this one and come back to you. All seems clear :-)

 

That's very kind of you :-) Thank you :-)

 

Here i'm not at home and come back Monday. At the first hour i try it :-)

 

Best regards

Posted (edited)

Hello

I try to understand derstand all part of the script. Some questions:

Only one file php with all the code?

 

How this part with "http://portal.example.com/pivot/resource-cid-select.php" means i must create reseource-cid-select.php upload on our ftp and the content is with the part wich start "<?php function signalwire($digitspl) { $signalwire = array(....." until the end?

 

Sorry for my lack of knowless :-(

 

May be comment on the code?

 

 

To resume what i try to do:

 

In the same place, there are users who work for multiple society. They must select the correct number when they place a call.

In Belgium, the international format of a call number is +32xx...  (32 is the prefix of Belgium). In france the prefix is +33xx.... 

We will have these numbers for example:

Society names "A": 3228992021

Society names"B": 3228992022

Society names "C": 3228992023

Society names "D": 33187651122

 

When a user(Caller) want to make a call, he can choose the number of the society wich will show on the phone of called.

The number of called could be like this form depend on the destiantion fixe or mobile:

32xxxxxxxx

32xxxxxxxxx

33xxxxxxxxx

Don't know if i'm clear :-(

 

Edited by Douillez (see edit history)
Posted

Hi. 

I have edited the previous post for easy understanding and how to know how are the first or the second pivot script.

The URL posted is an example, and you should set it to the site where your pivot scripts are hosted (it basically calls the second script with file named 'resource-cid-select.php')

The Caller ID would be chosen depending of the dialed digit.

If you dial (1)(1) after the prompt:

First Digit: Carrier #1 or Carrier #2

Second Digit: Caller ID in full format on kazoo

  • 2 weeks later...
Posted

I am going to give details about how it works.

When the number  is dialed outbound, it will ask the user to dial two digits. These two digits are split by the first one as the carrier to select, and the second one, the DID number selected as the caller ID on that carrier.

The code is wrote to split the carrier by required flags, so when adding your resources, you must specify a flag in the second pivot script and also set that same on the carrier to be configured.

If adding another different carrier you must add the function like: 

function myothercarrier($digitspl) {
$myothercarrier = array("1929XXXXXXX", "+1561XXXXXXX", "1786XXXXXXX", "1862XXXXXXXX");
header('content-type:application/json');

?>
{
                    "module": "dynamic_cid",
                    "data": {
			"action": "static",
			"caller_id" : {
				"name": "<?= $myothercarrier[$digitspl];   ?>",
				"number": "<?= $myothercarrier[$digitspl];   ?>"
				}
                    },
		    "children": {
			"_": {
				"module":"resources",
				"data": {
					"use_local_resources": false ,
					"outbound_flags": ["myothercarrier"],
					"to_did": "<?=  $calleeid ;    ?>"
					},
					"children": {}

				}


			}
                }
<?php
}

And also add some code, so the function must be executed, this one must be just below of the last similar one like:

if($digitspl['0'] === '8' ){
signalwire($digitspl['1']);
}

Note that the value is '8'  and must be increased by one on each  carrier addition (if there were seven, then you add digit 8. The numbers must be added on e164 or 1+NPA+NXX format, depending of how the carrier supports it.

Settings  that are required: 

The resource flags with require_flags: true ,  and also the flag value set.

The list of DID's on that carrier (if they are 7 for example, you add them separated by commas on the array, i recommend to add the first DID twice, because the array counts from zero)

The "use_local_resources" setting if you desire to use local resources or global (boolean).  

 

 

×
×
  • Create New...