amooma / GS3

Dies ist die Asterisk Version von Gemeinschaft
https://www.alternative-solution.de/gs3
41 stars 36 forks source link

outgoing callerid regex not correct processed if a comma in the regex #25

Closed dmueller4 closed 5 years ago

dmueller4 commented 11 years ago

If you set the outgoing callerid in the gateway, the normal regex s/^(.*)/5234567$1/ every thing works fine. But if you set e.g. s/^(.{1,4})$/5234567$1/ the regex will get split in our_route.agi.

The log shows this:

gemeinschaft*CLI> 
 /opt/gemeinschaft/dialplan-scripts/out-route.agi,0017xxxxxx1,no,9999,31: ### -GS- Processing CID RegExp: ^(.{1\
gemeinschaft*CLI> 
 /opt/gemeinschaft/dialplan-scripts/out-route.agi,0017xxxxxx1,no,9999,31: ### -GS- Processing CID RegExp: 4})$
gemeinschaft*CLI> 
    -- <SIP/9999-00000273>AGI Script /opt/gemeinschaft/dialplan-scripts/out-route.agi completed, returning 0

But it should look like this:

gemeinschaft*CLI> 
 /opt/gemeinschaft/dialplan-scripts/out-route.agi,0017xxxxxx1,no,9999,31: ### -GS- Processing CID RegExp: ^(.{1,4})$
gemeinschaft*CLI> 
 /opt/gemeinschaft/dialplan-scripts/out-route.agi,0017xxxxxx1,no,9999,31: ### -GS- Qualifying caller ID "9999" -> "52345679999" (s/^(.{1,4})$/5234567$1/) for gategroup "patton-pstn"

The code where it breaks is in line 216 and 217, where is the code snip of out-route.agi:

$ggrp['cid_s'] = trim($ggrp['cid_s']);
if ($ggrp['cid_s'] != '' &&
 ($ggrp_cid_s_a = explode(',',$ggrp['cid_s'])) &&
 ($ggrp_cid_r_a = explode(',',$ggrp['cid_r']))
 )
saschadaniels commented 11 years ago

The Dialplan behaves as expected.

Komma is used to seperate different regular expressions in one Gateway group.

The disadvantage is, that you can not use a regex with ','. You need to to write it in a different way.

The advantage is, that you can use several regular expressions with different substitutions on a trunk with several head numbers.

Greeta Sascha

Am 16.07.2013 um 21:06 schrieb Daniel Müller notifications@github.com:

If you set the outgoing callerid in the gateway, the normal regex s/^(.*)/5234567$1/ every thing works fine. But if you set e.g. s/^(.{1,4})$/5234567$1/ the regex will get split in our_route.agi.

The log shows this:

gemeinschaft_CLI> /opt/gemeinschaft/dialplan-scripts/out-route.agi,0017xxxxxx1,no,9999,31: ### -GS- Processing CID RegExp: ^(.{1\ gemeinschaft_CLI> /opt/gemeinschaft/dialplan-scripts/out-route.agi,0017xxxxxx1,no,9999,31: ### -GS- Processing CID RegExp: 4})$ gemeinschaft*CLI> -- <SIP/9999-00000273>AGI Script /opt/gemeinschaft/dialplan-scripts/out-route.agi completed, returning 0 But it should look like this:

gemeinschaft_CLI> /opt/gemeinschaft/dialplan-scripts/out-route.agi,0017xxxxxx1,no,9999,31: ### -GS- Processing CID RegExp: ^(.{1,4})$ gemeinschaft_CLI> /opt/gemeinschaft/dialplan-scripts/out-route.agi,0017xxxxxx1,no,9999,31: ### -GS- Qualifying caller ID "9999" -> "52345679999" (s/^(.{1,4})$/5234567$1/) for gategroup "patton-pstn" The code where it breaks is in line 216 and 217, where is the code snip of out-route.agi:

$ggrp['cid_s'] = trim($ggrp['cid_s']); if ($ggrp['cid_s'] != '' && ($ggrp_cid_s_a = explode(',',$ggrp['cid_s'])) && ($ggrp_cid_r_a = explode(',',$ggrp['cid_r'])) ) — Reply to this email directly or view it on GitHub.

dmueller4 commented 10 years ago

I've changed the separation sign to ';'. So I can use the regex and could implement more expressions. A little hint that a comma is used to separate several regular expressions would have been nice.