-1

I have a C# code but it doesn't takes a CallerID from dial up modem connected to USB port when I connect line to phone. It gets CallerID but in program run and in reading line I have just RING nothing else.

This is my code:

public partial class Form1 : XtraForm
{
    public Form1()
    {
        InitializeComponent();            
    }

    SerialPort sp ;
    private void simpleButton1_Click(object sender, EventArgs e)
    {            
        sp = new SerialPort(textEdit1.Text);
        sp.NewLine = "\r\n";
        sp.Parity = Parity.None;
        sp.DataBits = 8;
        sp.StopBits = StopBits.One;
        sp.DtrEnable = true;
        sp.WriteBufferSize = 1024;

        sp.Open();
        sp.WriteLine("AT+VCID=1");
        sp.RtsEnable = true;
        timer1.Start();
    }

    void sp_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
    {

    }

    private void Form1_FormClosed(object sender, FormClosedEventArgs e)
    {
        sp.Close();
    }

    private void timer1_Tick(object sender, EventArgs e)
    {
        memoEdit1.Text += "\n" + sp.ReadExisting();
    }

    private void simpleButton2_Click(object sender, EventArgs e)
    {
        sp.Close();
    }
jww
  • 97,681
  • 90
  • 411
  • 885
muxammed
  • 146
  • 2
  • 7
  • 1
    does your modem support receiving caller ID (FSK decoding)? – Manish Dalal May 01 '14 at 07:50
  • 3
    We expect users to post code that works, demonstrates the issue and is free of fluff. Your code is full of commented peices of code. Clean that up first. – rene May 01 '14 at 07:52
  • 1
    Yes in manual it is writing that it is supporting Caller id detection Conexant USB CX93010 ACF Modem – muxammed May 01 '14 at 08:00
  • @Manish - `AT+VCID=?` returns `(0-2)`, so yes the modem supports CallerID. – jww Feb 15 '19 at 01:09
  • This modems are wired I just run AT+VCID=1 and modem reported callerId flawlessly but after few day it stopped working. A French guy did some investigation on this modem but they don't solve my problem. https://www.domoticz.com/forum/viewtopic.php?t=33161 – MSS Dec 18 '21 at 14:22
  • Another one did some experiment on Conexant and USR usb modems here (this one also didn't solve the problem): https://superuser.com/a/1499229/398785 – MSS Dec 18 '21 at 14:25

4 Answers4

1

When your modem supports caller id then make use of AT+CLIP=1. This will cause unsolicited +CLIP messages to be displayed when the modem is called.

The +CLIP unsolicited messages are usually formulated as follows:

+CLIP: <number>,<type>,,,,<cli validity>

Where <number> is a string containing the number in a format defined by <type>. <type> of address octet which for example for international numbers is 145. <cli validity> determines whether the number was withheld etc.

jww
  • 97,681
  • 90
  • 411
  • 885
Matt Aldridge
  • 2,037
  • 16
  • 21
  • +VCID=1 could potentially solve your problems. It’s always good to track down an AT reference guide for your modem module. They are usually very useful on picking up on module specialities. – Matt Aldridge Feb 16 '19 at 08:27
1

Conexant USB CX93010 ACF Modem don't have FSK protocol

  • It does support FSK (actually most of dialup data modem work based on FSK). If you have any reference for it please mention that! I think it should be related to timing or data length – MSS Dec 18 '21 at 14:30
  • I also shoud mention some lines may based on DTMF And It work with fsk mutiolation but about the DTMF I cant get it to work. – MSS Mar 26 '22 at 09:12
1

I'm posting the code below based on some testing I was doing with the Conexant USB CX93010. The code below is in C (rather than C#) and runs on Linux (rather than Windows). But it should provide a good baseline for a C# program.

The code is based on another Stack Overflow answer written by Sawdust, and it has test results from the program.

You can also find a comprehensive AT command set for Conexant modems at http://www.arcelect.com. It is dated from 2001, but it has more AT commands for the modems than I found elsewhere on the web.


Here is the code.

#include <errno.h>
#include <fcntl.h> 
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>

#define DISPLAY_STRING 1

int set_interface_attribs(int fd, int speed)
{
    struct termios tty;

    if (tcgetattr(fd, &tty) < 0) {
        printf("Error from tcgetattr: %s\n", strerror(errno));
        return -1;
    }

    cfmakeraw (&tty);
    cfsetospeed(&tty, (speed_t)speed);
    cfsetispeed(&tty, (speed_t)speed);

    if (tcsetattr(fd, TCSANOW, &tty) != 0) {
        printf("Error from tcsetattr: %s\n", strerror(errno));
        return -1;
    }
    return 0;
}

void write_command(int fd, const void* cmd, size_t len)
{
    if (len == ~(size_t)0)
        len = strlen((const char*)cmd);

    printf("Send %d: %s\n", (int)len, (const char*)cmd);

    int wlen = write(fd, cmd, len);

    if (wlen != len) {
        printf("Error from write: %d, %d\n", wlen, errno);
    }
    tcdrain(fd);    /* delay for output */
}

void read_response(int fd)
{
    char buf[256];
    int rlen = read(fd, buf, sizeof(buf) - 1);

    if (rlen > 0) {
#ifdef DISPLAY_STRING
        buf[rlen] = 0;
        printf("Read %d: \"%s\"\n", rlen, buf);
#else /* display hex */
        unsigned char *p;
        printf("Read %d:", rlen);
        for (p = buf; rlen-- > 0; p++)
            printf(" 0x%x", *p);
        printf("\n");
#endif
    } else if (rlen < 0) {
        printf("Error from read: %d: %s\n", rlen, strerror(errno));
    } else {  /* rlen == 0 */
        printf("Timeout from read\n");
    }
}

int main(int argc, char* argv[])
{
    int fd;
    const char portname[] = "/dev/ttyACM0";

    fd = open(portname, O_RDWR | O_NOCTTY | O_SYNC);
    if (fd < 0) {
        printf("Error opening %s: %s\n", portname, strerror(errno));
        return -1;
    }

    /*baudrate 115200, 8 bits, no parity, 1 stop bit */
    set_interface_attribs(fd, B115200);

    write_command(fd, "ATZ\r", 4); /* Reset */

    read_response(fd);

    write_command(fd, "ATE0\r", -1);  /* Echo off */

    read_response(fd);

    write_command(fd, "AT+VCID=?\r", -1);  /* Query CallerID caps */

    read_response(fd);

    write_command(fd, "AT+CLIP=?\r", -1);  /* Query CallerID caps */

    read_response(fd);

    write_command(fd, "AT+VCID=1\r", -1);  /* Set CallerID */

    read_response(fd);

    printf("Entering loop, CTRL+C to break...\n\n");

    while (1)
    {
        read_response(fd);
    }

    return 0;
}

Here are the test results using a cell phone. I changed the name and phone number; other wise it is the exact output of the program.

$ sudo ./modem.exe
Send 4: ATZ
Read 6: "
OK
"
Send 5: ATE0
Read 11: "ATE0
OK
"
Send 10: AT+VCID=?
Read 15: "
(0-2)

OK
"
Send 10: AT+CLIP=?
Read 9: "
ERROR
"
Send 10: AT+VCID=1
Read 6: "
OK
"

Entering loop, CTRL+C to break...

Read 8: "
RING
"
Read 67: "
DATE = 0214
TIME = 2116
NMBR = 2025551212
NAME = JANE DOE
"
Read 8: "
RING
"
Read 67: "
DATE = 0214
TIME = 2116
NMBR = 2025551212
NAME = JANE DOE
"
Read 8: "
RING
"
Read 8: "
RING
"
Read 8: "
RING
"

Also, you can send an AT+GSR to get the real modem revision instead of what Windows provides (which appears to be a little inaccurate):

Send 7: AT+GMR
Read 44: "AT+GMR
+GMR: CX93001-EIS_V0.2013-V92

OK"
jww
  • 97,681
  • 90
  • 411
  • 885
0
  1. You must set Country of Installation to B5 by AT+GCI=B5 I got it after a three weeks of investigations (It may defer in your country it can be 00 or B4 or B5 but B5 for works for most of land lines):

    enter image description here

  2. Then enable CID reporting by AT+VCID=1 or AT+VCID=2 as it said in manual: enter image description here

  3. And then it works flawlessly: enter image description here

And this is my working code based on yours:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CIDResolver
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        SerialPort sp;
        private void Connect_click(object sender, EventArgs e)
        {
            sp = new SerialPort(textEdit1.Text);
            sp.BaudRate = 11500;
            sp.NewLine = "\r\n";

            sp.Open();

            sp.WriteLine("AT+GCI=B5"); // can be 00 or B4 or B5
            sp.WriteLine("AT+VCID=1");

            sp.DataReceived += new SerialDataReceivedEventHandler((object _s, SerialDataReceivedEventArgs _e) =>
            {
                string newData = sp.ReadExisting();
                consoleOut.Invoke((MethodInvoker)delegate {
                    // Running on the UI thread
                    consoleOut.Text += newData+ "\r\n";
                });
            });
        }


        private void disConnectBtn_Click(object sender, EventArgs e)
        {
            sp.Close();
        }

        private void Form1_FormClosed_1(object sender, FormClosedEventArgs e)
        {
            sp.Close();
        }
    }
}
MSS
  • 3,520
  • 24
  • 29