c# - AT commands hang up -


i have following snippet code using simulate call on pc dialer using @ commands.

the problem have sometimes, random number dialled, though user clicks "hang up" button on windows form, call still continues dialing in background.

the actual dial call code:

serialport po = new serialport(); po.portname = configurationmanager.appsettings.get("modemport"); po.baudrate = int.parse("9600"); po.databits = convert.toint32("8"); po.parity = parity.none; po.stopbits = stopbits.one; po.readtimeout = int.parse("300"); po.writetimeout = int.parse("300"); po.encoding = encoding.getencoding("iso-8859-1"); po.open(); po.writeline("atd" + phonenumber + ";\r"); 

then when clicking hang button, have code:

po.discardinbuffer(); po.discardoutbuffer(); po.close(); 

this keeps call dialing in background.

i added following test out, still same result.

po.writeline("ath" + "\r"); po.writeline("ath0;\r"); po.writeline("ath+chup;\r"); 

any ideas?

note @ command set officially called hayes command set. information on wiki page offer help. various reasons can cause hangup (ath0) not work. first of i'm not sure use of semicolon, should not needed. secondly, modem may in data mode need switch manned mode first (using '+++') before writing hangup command. options configure modem drop connection on drop of dtr signal (and drop dtr hangup). more info on here.


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -