diff --git a/asterisk_click2dial/scripts/get_cid_name.py b/asterisk_click2dial/scripts/get_cid_name.py index 887c94c..b774cf8 100755 --- a/asterisk_click2dial/scripts/get_cid_name.py +++ b/asterisk_click2dial/scripts/get_cid_name.py @@ -165,6 +165,14 @@ def main(options, arguments): for variable in stdinput.keys(): stderr_write("%s = %s\n" % (variable, stdinput.get(variable))) + # If we already have a "True" caller ID name + # i.e. not just digits, but a real name, then we don't try to + # connect to OpenERP or geoloc, we just keep it + if stdinput.get('agi_calleridname') and not stdinput.get('agi_calleridname').isdigit(): + stdout_write('VERBOSE "Incoming CallerID name is %s"\n' % stdinput.get('agi_calleridname')) + stdout_write('VERBOSE "As it is a real name, we do not change it"\n') + return True + input_cid_number = stdinput.get('agi_callerid') stderr_write('stdout encoding = %s\n' % sys.stdout.encoding or 'utf-8') diff --git a/asterisk_click2dial/scripts/get_cid_name_timeout.sh b/asterisk_click2dial/scripts/get_cid_name_timeout.sh index b1e9bf8..191cf82 100755 --- a/asterisk_click2dial/scripts/get_cid_name_timeout.sh +++ b/asterisk_click2dial/scripts/get_cid_name_timeout.sh @@ -22,4 +22,6 @@ # echo "agi_callerid:0141981242"|get_cid_name_timeout.sh # where 0141981242 is a phone number that could be presented by the calling party -timeout 2s /usr/local/bin/get_cid_name.py --server openerp.mycompany.com --database erp_prod --user-id 12 --password "thepasswd" --geoloc --geoloc-country "FR" --geoloc-lang "fr" +PATH=/usr/local/sbin:/usr/local/bin:/var/lib/asterisk/agi-bin:/sbin:/bin:/usr/sbin:/usr/bin + +timeout 2s get_cid_name.py --server openerp.mycompany.com --database erp_prod --user-id 12 --password "thepasswd" --geoloc --geoloc-country "FR" --geoloc-lang "fr"