c# - Caller ID - Cannot obtain incoming Number -


the label on ui keeps reading "ring ring" , empty "". doesn't display incoming number, want. tried add if function checking if there '0' in data reason still doesn't work.

the following code:

using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.windows.forms; using system.io.ports;  namespace callerid {     public partial class callerid : form     {         public callerid()         {             initializecomponent();             port.open();             watchmodem();             setmodem();         }          protected override void onpaint(painteventargs e)         {             base.onpaint(e);             watchmodem();         }          private serialport port = new serialport("com3");         string callname;         string callnumber;         string readdata;          private void setmodem()         {             port.writeline("at+vcid=1\n");             port.rtsenable = true;         }          private void watchmodem()         {             port.datareceived += new serialdatareceivedeventhandler(port_datareceived);         }          public delegate void setcalleridtext();          private void port_datareceived(object sender, serialdatareceivedeventargs e)         {             readdata = port.readexisting();             //add code split up/decode incoming data             if (lblcalleridtitle.invokerequired)             {                 if (readdata.contains('0'))                     lblcalleridtitle.invoke(new setcalleridtext(() => lblcalleridtitle.text = readdata));             }             else                 lblcalleridtitle.text = readdata;         }     } } 

it's been while since i've worked modems, modem has support callerid (i'm sure nowadays), have have callerid service telco (i'm sure do), , finally, there @ command send modem during initialization turn on callerid reporting. depending on model of modem you're using, command may different, it's typically at#cid=1. modem's manual should have @ code use.

note incoming number sent between first , second rings.


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -