Announcement

Collapse
No announcement yet.

Auto dialling

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Auto dialling

    I have a program which automatically dials through a modem

    It works fine

    But sometimes the people at the other end cannot hear me very well - and it suddenly comes better after about a minute

    My theory is something times out but what and how can I force it?

    Can anyone suggest anything

    CODE IS SHOWN

    Code:
    SUB actually_dial_number '&&&&&&&&&&&&
    
    COMM OPEN "COM3" AS #hComm
    COMM SEND #hComm, "ATDT" + current_telephone_number +$CRLF
    modem_input_data_length=0
    DO UNTIL modem_input_data_length>0
    modem_input_data_length = COMM(#hComm, RXQUE)
    COMM RECV #3, modem_input_data_length, modem_input_data
    LOOP
    END SUB 'actually_dial_number '&&&&&&&&&&&&
    Thanks in advance
    [I]I made a coding error once - but fortunately I fixed it before anyone noticed[/I]
    Kerry Farmer

  • #2
    The MODEM is just dialing, you're on a phone? Then --

    When the MODEM hangs up (disconnects itself from line) after dialing, 3dB more of voice power from your phone goes to phone switch instead of audio transformer. in MODEM.

    Cheers,
    Dale

    Comment


    • #3
      Forgot
      . . . and how can I force it?
      Send ATH to MODEM (most brands)

      Cheers,
      Dale

      Comment


      • #4
        Originally posted by Dale Yarker View Post
        Forgot Send ATH to MODEM (most brands)

        Cheers,
        "Then if a dial command is sent to it (ATD...), it dials and connects to another modem. It's now in the on-line data mode (connected) and sends and receives data (such as Internet pages). In this mode, any AT command one trys to send it will not work but will be transmitted to the other modem instead. Except for the escape command. This is +++ with a minimum time delay both at the start and end. The time delay allows the modem to determine that it is likely a real escape and not just +++ in a file being transmitted."
        So you'd need something like:

        SLEEP 1000
        COMM SEND #hComm, "+++"
        SLEEP 1000
        COMM SEND #hComm, "ATH"

        (Geez, it's a long time since I did anything with modems. I just pulled up a backup disk and the last thing I wrote along those lines was in 2000 )
        I just closed the COMM port when connected . That works because it drops the DTR signal.

        The way I handled it was a popup to say "Dialling" and close the dialog and COMM port as soon as the user confirms the connection.
        Here's that 22 year old code - it should still work, but I'd write it a bit differently today.
        Code:
        SUB callnum (pnum AS STRING)
             #REGISTER NONE
            LOCAL portnum AS INTEGER
            LOCAL result AS LONG
            LOCAL callname AS STRING
            portnum = VAL(comport)
            LOCAL portstr AS STRING
            LOCAL dialstr AS STRING
            portstr = "COM" & TRIM$(STR$(portnum))
            IF portnum = 0 THEN
               MSGBOX "No COM port specified for the modem. To specify a comport add a '-Px'  switch to the commandline when starting the program where 'x' is the port number",,"Lexacorp Phone Book"
               EXIT SUB
            END IF
        
           DIALOG NEW hdlg, "Calling  " & pnum,,,120,50,%DS_MODALFRAME  ,  TO hDlg2
           CONTROL ADD LABEL, hdlg2,99,"Press  button when connected",5,5,230,12
            CONTROL ADD BUTTON ,hdlg2,1,"OK/Cancel",5,20,50,14 CALL closedialog
            dialstr = "AT " & modeminit & " DT" & pnum & CHR$(13) & CHR$(10)
            COMM OPEN portstr AS #2
            COMM SET #2, BAUD     = 9600   ' 9600 baud
            COMM SET #2, BYTE     = 8      ' 8 bits
            COMM SET #2, PARITY   = %FALSE ' No parity
            COMM SET #2, STOP     = 0      ' 1 stop bit
            COMM SET #2, TXBUFFER = 2048   ' transmit buffer
            COMM SET #2, RXBUFFER = 4096   ' receive buffer
            COMM SEND #2, dialstr
            DIALOG SHOW MODAL hDlg2 TO result
            COMM CLOSE #2
            END SUB
        ...
        CALLBACK FUNCTION closedialog()
        DIALOG END CBHNDL, 1
        END FUNCTION

        Comment


        • #5
          Originally posted by Kerry Farmer View Post
          I
          Code:
          DO UNTIL modem_input_data_length>0
          modem_input_data_length = COMM(#hComm, RXQUE)
          COMM RECV #3, modem_input_data_length, modem_input_data
          LOOP
          Haven't tried it, but that looks as though you are waiting until you detect the data stream when they answer the phone.
          In which case, you can close the COMM port then.



          Comment


          • #6
            Hmmm, but with no MODEM at other end how did MODEM at this end get in connected mode?
            Dale

            Comment


            • #7
              Or,
              add a pause and H after last digit in ATD string.
              Dale

              Comment


              • #8
                Originally posted by Dale Yarker View Post
                Hmmm, but with no MODEM at other end how did MODEM at this end get in connected mode?
                Hmm, good qusetion. I may well be mistaken. However:

                From the ActiveExperts website (I spent quite a bit of time and effort developing on their SMS Server )
                "When a modem isn't connected or connecting to another modem, it's in what's called command mode. When a modem is in command mode, the modem can accept commands from you, in the form of strings written to the serial port to which the modem is attached. "

                Also, note the absence of a semicoon after the phone number in Gary's code.
                ; - Return to Command State after Dialing
                The semicolon ( ; dial modifier, used only at the end of a command line (just before the <CR>), instructs the modem to return to the command state immediately after dialing, without breaking the connection.



                If Kerry puts a semicolon after his number, he can use AT+CLCC to monitor status and hang up when connected.
                See the example (VBScript for a GSM modem, but it's still Haves compatible AT commands) at https://www.activexperts.com/serial-...rials/gsmdial/

                Comment


                • #9
                  Gary who? Kerry Maybe.
                  AT+CLCC is for GSM, not POTS. No signaling on POTS line to indicate call status except ring-back, busy and error tones; and checking those would be a whole other project. Pretty sure he has not connected a MODEM to cell phone to dial numbers.
                  Dale

                  Comment


                  • #10
                    Originally posted by Dale Yarker View Post
                    Gary who? Kerry Maybe.
                    Oops, fixed

                    Comment


                    • #11
                      Thanks guys

                      You really are a wonderful lot

                      I am working through these matters and see how I get on

                      Thanks again

                      Kerry
                      [I]I made a coding error once - but fortunately I fixed it before anyone noticed[/I]
                      Kerry Farmer

                      Comment


                      • #12
                        Here is the process............

                        I am using the computer to dial the number
                        • It is a landline at both ends
                        • Yes, after I have dialled, I pick up the phone and talk
                        • If it is engaged, no such number or a message, I just note the fact (slightly more complicated!) and go onto the next number

                        So your analysis is correct Dale

                        So do I add....
                        Code:
                        SLEEP 1000
                        COMM SEND #hComm, "+++"
                        SLEEP 1000
                        COMM SEND #hComm, "ATH"
                        after the loop?

                        If Kerry puts a semicolon after his number, If my number is now "123456", I make it "23456;"????

                        Do I use both the extra code and the semicolon? Or shall I try one or the other?

                        Thanks again guys. [I am out of my depth here, but it is nearly working!] [Really impressed with the speed of reply - from all around the world!!]

                        Kerry


                        [I]I made a coding error once - but fortunately I fixed it before anyone noticed[/I]
                        Kerry Farmer

                        Comment


                        • #13
                          . . . go onto the next number
                          ??? I think I'm done here.
                          Dale

                          Comment


                          • #14
                            Thanks Dale - you helped a lot to define the problem. Kerry
                            [I]I made a coding error once - but fortunately I fixed it before anyone noticed[/I]
                            Kerry Farmer

                            Comment


                            • #15
                              I have learned a lot

                              This fixed it:
                              Code:
                              SLEEP 5000
                              COMM CLOSE #hComm
                              One other problem...

                              If I dial 10 digit numbers, it is ok
                              If I dial 14 numbers it fails to dial properly
                              [I think this is the problem, but it might be just problem with dialling internationally]

                              I am working on splitting the numbers up into two "SEND's" but not having much luck yet

                              You get such long numbers when dialing internationally

                              [PS Stop worrying Dale, I only call businesses]
                              [I]I made a coding error once - but fortunately I fixed it before anyone noticed[/I]
                              Kerry Farmer

                              Comment


                              • #16
                                Maybe use the coma between different parts of the number to make it pause for 2 sec before dialing the next part.
                                you can check the current value for the Pause, I think it's register S8 in the modem ATS8? should give the current value ATS8=xx to set value (0-65) sec default usually 2 sec

                                also register S11 holds the dial duration, you can try increasing it . same (50–150) 95ms usually default ATS11=120

                                Comment


                                • #17
                                  Thanks Rod

                                  Definitely worth a try
                                  [I]I made a coding error once - but fortunately I fixed it before anyone noticed[/I]
                                  Kerry Farmer

                                  Comment


                                  • #18
                                    This works

                                    Code:
                                    COMM OPEN "COM3" AS #hComm
                                    COMM SEND #hComm, "ATDT" +MID$(current_telephone_number,1,6)
                                    SLEEP 100
                                    COMM SEND #hComm, "ATDT" +MID$(current_telephone_number,7)
                                    COMM SEND #hComm, "ATDT" +$CRLF
                                    modem_input_data_length=0
                                    DO UNTIL modem_input_data_length>0
                                    modem_input_data_length = COMM(#hComm, RXQUE)
                                    COMM RECV #3, modem_input_data_length, modem_input_data
                                    LOOP
                                    DIM m AS STRING
                                    INPUT "press enter when call gone through",m
                                    COMM CLOSE #hComm
                                    The split dialling line allows long numbers

                                    the COMM CLOSE means that the voices are louder

                                    Still experimenting and checking

                                    Might be able to replace the INPUT/,<enter. with SLEEP after a bit more experimentation. I cannot find a way of automatically checking if the call has gone through

                                    Thank you all again
                                    [I]I made a coding error once - but fortunately I fixed it before anyone noticed[/I]
                                    Kerry Farmer

                                    Comment


                                    • #19
                                      I have been doing more work on this

                                      I suspect there are issues with long numbers -14 characters long for instance

                                      And I suspect that there are issues/delays/interruptions calling internationally

                                      The exchange/s do not seem to recognise the number most of the time - but not always.

                                      I am calling Australia from New Zealand

                                      There is a prefix of '00' to get an international call and then you dial '61' for Australia and then the Australian number without the leading zero

                                      In particular, I suspect that after dialling the international Australia 4 numbers, then the system needs a moment to connect properly as presumably I am moving from a NZ exchange to an Australian exchange

                                      I can call NZ numbers with no extra code

                                      My suspicion is that the numbers are sent too fast.

                                      I think the window is always open because if you dial manually, it takes much longer.

                                      But calling Australia I am having some success with

                                      [CODE]COMM OPEN "COM3" AS #hComm
                                      DIM call_count AS LONG
                                      call_count = 1
                                      DIM call_wait AS LONG
                                      call_wait = 1
                                      DO UNTIL call_count > LEN(current_telephone_number)
                                      COMM SEND #hComm, "ATDT" + MID$(current_telephone_number,call_count,1)
                                      INCR call_count
                                      SLEEP call_wait
                                      LOOP
                                      COMM SEND #hComm, "ATDT" +$CRLF
                                      modem_input_data_length=0
                                      DO UNTIL modem_input_data_length>0
                                      modem_input_data_length = COMM(#hComm, RXQUE)
                                      COMM RECV #3, modem_input_data_length, modem_input_data
                                      LOOP[/CODE]



                                      Any thoughts or comments would be welcome.

                                      Thanks

                                      Kerry

                                      PS I suspect this is not the whole story!
                                      Last edited by Kerry Farmer; 21 Jul 2022, 11:54 PM.
                                      [I]I made a coding error once - but fortunately I fixed it before anyone noticed[/I]
                                      Kerry Farmer

                                      Comment


                                      • #20
                                        Originally posted by Kerry Farmer View Post
                                        I have been doing more work on this

                                        I suspect there are issues with long numbers -14 characters long for instance

                                        And I suspect that there are issues/delays/interruptions calling internationally

                                        The exchange/s do not seem to recognise the number most of the time - but not always.

                                        I am calling Australia from New Zealand

                                        There is a prefix of '00' to get an international call and then you dial '61' for Australia and then the Australian number without the leading zero

                                        In particular, I suspect that after dialling the international Australia 4 numbers, then the system needs a moment to connect properly as presumably I am moving from a NZ exchange to an Australian exchange

                                        I can call NZ numbers with no extra code
                                        !
                                        Insert comma(s) after the 00 in the number string
                                        The default pause for a comma is 2 seconds but you can change it by setting register S8.
                                        S8=1 will change it to one second ( value is an inetgral number of seconds from 0 to 255.

                                        Code:
                                        If left$(strNumber) = "00" then strNumber = "00," & mid$(strNumber,3) 'pause for 2(?) seconds after international switch
                                        It's extremely doubtful that you will need to place another pause after the area code (the single digit after you have stripped off the leading "0" of the Australian number) but if you still have a problem, it won't do any harm.

                                        Comment

                                        Working...
                                        X