faucamp / python-gsmmodem

Python module to control a GSM modem attached to the system: send/receive SMS messages, handle calls, etc
GNU Lesser General Public License v3.0
386 stars 304 forks source link

order of commands #5

Closed dauheeIRL closed 11 years ago

dauheeIRL commented 11 years ago

Hi Its me again :)

in the demos such as the following: modem = GsmModem(PORT, BAUDRATE, smsReceivedCallbackFunc=handleSms) modem.smsTextMode = True modem.connect(PIN)

I need to reorder the the check for pin to be the first thing called in def connect because ATZ is rejected until PIN is entered. This may be something specific to my particular GSM dongle so may not be of relevance.

faucamp commented 11 years ago

Aah, thanks - this indeed specific to your modem. I will change this right away, but would you mind posting the output of the "identify-modem.py -d" script (using the -d parameter) - this way I can add your modem's profile to the unit tests.

As always, thanks for the report. :)

dauheeIRL commented 11 years ago

Thank you very much faucamp. Output below. If there is anything else I send on please let me know (you are helping me after all :))

C:\Per\Tools\raspberry pi\backup_Dev\scripts-dev>c:\python27\python identify-modem.py COM9 -p 6572 -d args: Namespace(baud=115200, debug=True, pin='6572', port='COM9') Connecting to GSM modem on COM9...

== MODEM DEBUG INFORMATION ==

ATI ['Manufacturer: QUALCOMM INCORPORATED', 'Model: M6280', 'Revision: M6280_V1.0.0 M6280_V1.0.0 1 [Sep 4 2008 12:00:00]', 'IMEI: 359405030462319', '+GCAP: +CGSM,+FCLASS,+DS', 'OK'] AT+CGMI: ['QUALCOMM INCORPORATED', 'OK'] AT+CGMM: ['M6280', 'OK'] AT+CGMR: ['M6280_V1.0.0 M6280_V1.0.0 1 [Sep 4 2008 12:00:00]', 'OK'] AT+CFUN=?: ['+CFUN: (0-1,4-7),(0-1)', 'OK'] AT+WIND=?: ['ERROR'] AT+WIND?: ['ERROR'] AT+CPMS=?: ['+CPMS: ("ME","MT","SM","SR"),("ME","MT","SM","SR"),("ME","MT","SM","SR")', 'OK'] AT+CNMI=?: ['+CNMI: (0,1,2,3),(0,1,2,3),(0,2),(0,1,2),(0,1)', 'OK'] AT+CVHU=?: ['+CVHU: (0-1)', 'OK'] AT+CSMP?: ['+CSMP: 49,167,0,0', 'OK'] AT+GCAP: ['+GCAP: +CGSM,+FCLASS,+DS', 'OK'] AT+CPIN? ['+CPIN: READY', 'OK'] AT+CLAC: ['ERROR']

faucamp commented 11 years ago

Fixed in de0505e75df0fe8ba303403f312ba0032d603fde.

Thanks for the debug info; I've added this modem's profile to the test cases. If you are planning on using this modem to detect or respond to incoming phone calls, I may need your assistance again, as I am struggling to find information on the incoming call notifications generated by this particular modem (it does not seem to support either the Huawei or Wavecom-style of call notification). If you are willing, I will modify identify-modem.py to capture this information?

dauheeIRL commented 11 years ago

I really appreciate this. That would be fantastic. Yes certainly I will run the updated identify-modem.py.

I've just given this a go and it can detect calls and hang up with my modem (dtmf not supported).

On Mon, Apr 22, 2013 at 2:46 PM, Francois Aucamp notifications@github.comwrote:

Fixed in de0505ehttps://github.com/faucamp/python-gsmmodem/commit/de0505e75df0fe8ba303403f312ba0032d603fde .

Thanks for the debug info; I've added this modem's profile to the test cases. If you are planning on using this modem to detect or respond to incoming phone calls, I may need your assistance again, as I am struggling to find information on the incoming call notifications generated by this particular modem (it does not seem to support either the Huawei or Wavecom-style of call notification). If you are willing, I will modify identify-modem.py to capture this information?

— Reply to this email directly or view it on GitHubhttps://github.com/faucamp/python-gsmmodem/issues/5#issuecomment-16786618 .

faucamp commented 11 years ago

I've just given this a go and it can detect calls and hang up with my modem (dtmf not supported).

I'm glad! I assume this was using the incoming_call_demo.py example script? If so, please uncomment the logging setup line in the main() method of that script:

#logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.DEBUG

...and run it again. Somewhere during the log messages for the modem.connect() method you will see a message such as "Loading Huawei call update table" or "Loading Wavecom call update table". I am assuming the GsmModem class is loading the Huawei call update table - could you please confirm this? I will then add a check for that modem's manufacturer to enable DTMF support.

dauheeIRL commented 11 years ago

Hi,

I get the following output from running incoming_call_demo.py (works perfectly, no dtmf):

C:\Per\Tools\raspberry pi\backup_Dev\scripts-dev>c:\python27\python incoming_call_demo.py Initializing modem... INFO: Connecting to modem on port COM9 at 115200bps DEBUG: write: ATZ DEBUG: response: ['OK'] DEBUG: write: ATE0 DEBUG: response: ['ATE0\r', 'OK'] DEBUG: write: AT+CFUN? DEBUG: response: ['+CFUN: 1', 'OK'] DEBUG: write: AT+CMEE=1 DEBUG: response: ['OK'] DEBUG: write: AT+CPIN? DEBUG: response: ['+CPIN: READY', 'OK'] DEBUG: write: AT+CLAC DEBUG: response: ['ERROR'] DEBUG: write: AT+WIND? DEBUG: response: ['ERROR'] INFO: Loading Huawei call update table DEBUG: write: AT+COPS=3,0 DEBUG: response: ['OK'] DEBUG: write: AT+CMGF=0 DEBUG: response: ['OK'] DEBUG: write: AT+CSMP=49,167,0,0 DEBUG: response: ['OK'] DEBUG: write: AT+CPMS=? DEBUG: response: ['+CPMS: ("ME","MT","SM","SR"),("ME","MT","SM","SR"),("ME","MT","SM","SR")', 'OK'] DEBUG: write: AT+CPMS="SM","SM","SR" DEBUG: response: ['+CPMS: 0,30,0,30,0,100', 'OK'] DEBUG: write: AT+CNMI=2,1,0,2 DEBUG: response: ['OK'] DEBUG: write: AT+CLIP=1 DEBUG: response: ['OK'] DEBUG: write: AT+CRC=1 DEBUG: response: ['OK'] DEBUG: write: AT+CVHU=0 DEBUG: response: ['OK'] Waiting for incoming calls... DEBUG: notification: ['+CRING: VOICE', '+CLIP: "0870000000",128,,,,0'] DEBUG: Handling incoming call Incoming call from: 087000000 DEBUG: notification: ['+CRING: VOICE', '+CLIP: "0870000000",128,,,,0'] DEBUG: Handling incoming call Modem has no DTMF support - hanging up call. DEBUG: write: ATH DEBUG: response: ['OK']