Summary:ASTERISK-14453: callerid in Canada does not work for Voicetronix Openswitch12
Reporter:Rick Stonehouse (rick_in_hfx)Labels:
Date Opened:2009-07-10 22:23:08Date Closed:2011-06-07 14:07:48
Versions:Frequency of
Description:I have tried product versions from through to current 1.6.2 beta3.  None seem to work to have vpb pick up callerid from PSTN trunk or to pass along callerid presentation for analogue phones connected on FXS ports.
I have tried all available options for callerid=____ in the /etc/asterisk/vpb.conf file.  I am also using last version of vpb driver from Voicetronix.

The best I can do without major research is to go with callerid=on and modify chan_vpb.cc. (see in Additional Information below)
Still, I can't get Asterisk to pass cid from caller to called.  On the plus side, my CID does show in a SIP call.  :)


made change in function get_callerid() in code block commented as "This decodes FSK 1200 baud type callerid"
I changed "if (cli_struct->ra_cldn[0] == '\0') {"
to "if (cli_struct->ra_cldn[0] != '\0') {"
and also changed references to "cldn" to "cdn" (as Canada picks up callerid from field 4, not 3 as it is in the US).  Frankly the first change from "==" to "!=" was a fluke as I read it wrong.  I know the point is if the reason for absence of callerid is "" then we theoretically have a cldn.

Unfortunately, this still does not fix the problem with cid showing up on the called device.  It only shows in the debug messages.
Comments:By: Rick Stonehouse (rick_in_hfx) 2009-07-10 22:36:13

Should add that I'm running CentOS 5.3.
I've run fresh installs of OS and Asterisk trying each version.

I made a mistake in the field #.  CLDN is found in 3 instead of 2 for the US.
field 4 is RA_CLDN (reason for absence of Diable Direct Number).
Specs for Canadian DMS100 switches is found at:

By: Rick Stonehouse (rick_in_hfx) 2009-07-11 14:57:39

I have tried rerunning with unmodified code with the following results:
callerid=bell segmentation error - crashes Asterisk
callerid=v23  segmentation error - crashes Asterisk
callerid=on "ERROR[25191]: chan_vpb.cc:703 void get_callerid(vpb_pvt*): CID record - Failed to decode caller id on vpb/0-11 - -1"
callerid=off obviously no problem with callerid code.

I was calling from a landline (PSTN) and dialing to an internal extension.
on CentOS 5.3 (kernel: 2.6.18-128.el5)

By: Rick Stonehouse (rick_in_hfx) 2009-07-12 14:35:44

Problems with chan_vpb.cc in Canada (debug code added):

       if ((rc = vpb_cid_decode2(cli_struct, buf, CID_MSECS * 8)) == VPB_OK ) {


               if (owner->cid.cid_num)



               if (owner->cid.cid_name)





 I need to find out what is populated

 in each field whether it is used or not


             ast_log(LOG_ERROR, "DEBUG::CID record - got [%s] [%s]", cli_struct->cldn, cli_struct->ra_cldn);

             ast_log(LOG_ERROR, "DEBUG::           - got [%s] [%s]", cli_struct->cdn, cli_struct->cn);

             if (cli_struct->ra_cldn[0] != '\0') {


                      owner->cid.cid_num = ast_strdup(cli_struct->cldn);

                      owner->cid.cid_name = ast_strdup(cli_struct->cn);



 In Canada, the Calling number

 shows up in Called number field

 - Need to populate field used

   by the program - 'cldn'


       /              strcpy(cli_struct->cldn, cli_struct->cdn);

                      if (owner) {

                              ast_set_callerid(owner, cli_struct->cldn, cli_struct->cn, cli_struct->cldn);

                      } else {

                              strcpy(p->cid_num, cli_struct->cldn);

                              strcpy(p->cid_name, cli_struct->cn);


Found out from the display of cli_struct->ra_cldn what now makes sense, it's value is not NULL, but rather it is '0', as set prior to the call to vpb_cid_decode2().  The reason is that cli_struct->clid does not contain anything.  If it did, then ra_cldn would be reset to NULL '\0'.
      > Using VPB Caller ID

      > CID record - start

   -- Executing [s@from-pstn:1] Wait("vpb/0-11", "5") in new stack

      > CID record - skipped 501ms trailing ring

      > CID record - recorded 4021ms between rings

[Jul 11 13:50:27] ERROR[7040]: chan_vpb.cc:688 void get_callerid(vpb_pvt*): DEBUG::CID record - got [] [O]
[Jul 11 13:50:27] ERROR[7040]: chan_vpb.cc:689 void get_callerid(vpb_pvt*): DEBUG::           - got [4011099] [RICHARD STONEHO]       > CID record - got [4011099] [RICHARD STONEHO]

callerid.c – func: callerid_feed().  Case 4 refers to /* number */, but for Bell Canada, that is 'Reason for Absence of Diable Directory Number' (calling number id).  In the case of Canadian received calls, that field never gets reset from '0'... so callerid_feed does try to process it.  Could this possibly cause the segmentation fault??

/vpb-driver-4.2.41/src/libvpb/vpbapi.h – contains another definiton of the identifiers for CID..., albeit VPB_CID_CALLING_LINE_DN and VPB_CID_CALLED_DN are not correct for Canada.

Just to reiterate, this problem affects everything callerid related and CDR related.  All I can do successfully is receive calls and make calls.  Hmmm, sounds like a phone, not a PBX.  :(

Now, I do not see where the callerid is presented to the called device.... Looking into that.

By: Leif Madsen (lmadsen) 2009-07-13 07:23:01

Dropping severity of this from major to minor as chan_vpb is not well supported.

By: Rick Stonehouse (rick_in_hfx) 2009-07-21 20:32:04

I don't mind taking this task on.  Who is the 'expert' on the chan_vpb.cc code, other than just the entity Voicetronix?
I would like to be able to bounce certain questions once in awhile.
I have nearly 20 years experience in programming and several of those in realtime programming.  I really need the knowledge of someone on the voictronix board and basic telephony functionality (handset side).  I worked as a programmer on the CDR side of the telco, with billing, cell call legs, etc.

By: Leif Madsen (lmadsen) 2009-07-24 11:40:25

Well, there isn't any expert on this code, which is why it is not maintained :) I'd suggest you bounce ideas/questions off the asterisk-dev mailing list, since that will give you the largest pool of Asterisk developers that may be able to help.


By: Leif Madsen (lmadsen) 2009-09-18 08:02:56

I'm going to Acknowledge this issue, but it will still remain low in the priority pool unfortunately.

If you happen to start a discussion on the asterisk-dev mailing list, then maybe you can link back to that discussion here (the archives are available at http://lists.digium.com)


By: Leif Madsen (lmadsen) 2009-11-11 11:00:32.000-0600

I'm going to close this issue as suspended right now as this isn't something that is likely to be supported unless a community member wishes to support the channel, or wishes to at least provide a patch for this issue.

The issue can request to be reopened by a bug marshal on the Freenode IRC network at irc.freenode.net in #asterisk-bugs. Thanks!