Currently you have the following information available when using `phonenum_match(num, pvc)` from the `phonenum` module:
* number - phone number that is matched * valid - 1 if the matched number has a valid result; 0 otherwise * normalized - normalized phone number * cctel - country code for phone number * ltype - local network type * ndesc - phone number description * error - error string if phone number matching fails.
It would be useful to have access also to the `cc` information.
Right now, `cctel` outputs the country code (digits) for the number.
Example:
+34123456789 --> cctel = 34
The enhancement would be to add the country code (string) for the number (maybe in the `cc` position?):
+34123456789 --> cc = ES
Having a look at the phonenum module code (`cphonenumber.cpp`), I understand (with my very little idea of C) that country code (string) information is in fact used to get the country code (digits). So I think it would be only a matter of returning one more key:value:
https://github.com/kamailio/kamailio/blob/master/src/modules/phonenum/cphone...
``` string regionCode; _phoneUtil.GetRegionCodeForNumber(parsedNumber, ®ionCode); res->cctel = _phoneUtil.GetCountryCodeForRegion(regionCode); ```
Something like (pseudocode, this obviously doesn't work but gives the idea):
``` string regionCode; _phoneUtil.GetRegionCodeForNumber(parsedNumber, ®ionCode); res->cctel = _phoneUtil.GetCountryCodeForRegion(regionCode); res->cc = regionCode; ```
So then later in kamailio you can do for example:
```xlog("L_INFO", "Call from $phn(src=>cc) to $phn(dst=>cc)\n");```
I have also seen that a function to provide this info exists in the module level, but I haven't seen it used anywhere else but the declaration:
https://github.com/kamailio/kamailio/blob/master/src/modules/phonenum/cphone...
This feels like a really easy change and I tried to do it myself, but I didn't manage to get through the complete path from "getting the info" to "making it available in the pvc" so here I am asking for help.
Thanks!
Pushed the commit referenced above that adds ccname attribute. No time to test it, if not working, open an issue.
Closed #1576.
Thanks for testing and feedback.