Facebook   Twitter    e-mail newsletter    YouTube    RSS Feed    Android App    iPhone and iPad App     BlackBerry App    


Results 1 to 15 of 15

Thread: USSD Commands returning NO CARRIER

  1. #1

    Unhappy USSD Commands returning NO CARRIER

    Hi guys, I have a Huwaei modem(E175). I am programatically(via Java) sending commands to the modems serial port (/dev/ttyUSB0) and things seem to be ok except when I started handling the USSD commands, I simply get the response ERROR / NO CARRIER from the modem depending on how I have sent the USSD command(See below for details). I understand that we have data mode and command mode, what I don't understand is how to explicitly switch between the modes. I would also like to know the detailed meaning of NO CARRIER, does it call for my explicit registration into a GSM network, or what is NO CARRIER supposed to mean in this context? Or is their something I am supposed to do before a USSD session, because if its the network, I am able to send SMS with the modem without the NO CARRIER response. Please help, if you know the workaround, I'd appreciate. A section of the outputs of my program are pasted below.

    When sending the USSD command using AT+CUSD:
    Code:
    Submitted AT command: AT+CMGF=1
    
    OK
    
    Submitted AT command: AT+CGREG?
    
    +CGREG: 0,1
    
    OK
    
    Submitted AT command: AT+CUSD=1,"*144#"
    
    ERROR
    If i try to send USSD using ADT, i get the NO CARRIER response.
    Code:
    Successfully opened the serial port /dev/ttyUSB0
    Submitted AT command: AT+CMGF=1
    
    OK
    
    Submitted AT command: AT+CGREG?
    
    +CGREG: 0,1
    
    OK
    
    Submitted AT command: ATD*144#
    
    NO CARRIER
    Note: *144# is the USSD code used to check balance with my SIM Operator.
    Last edited by nmvictor; 30-08-2011 at 11:51 PM. Reason: jUST CORRECTIONS

  2. #2
    Super Grandmaster ginggs's Avatar
    Join Date
    Jun 2006
    Location
    Good-w00t! Cape Town
    Posts
    7,710

    Default

    Quote Originally Posted by nmvictor View Post
    AT+CUSD=1,"*144#"
    Try:
    AT+CUSD=1,"*144#",15

    Quote Originally Posted by nmvictor View Post
    Submitted AT command: ATD*144#

    NO CARRIER
    This is to be expected, sending a USSD command and dialling are actually two different operations, it's just that most handsets use the call or green button to send USSD as well as make a call.

  3. #3

    Default

    Thanks for the reply. I have tried with that but I still get the ERROR response.

    Code:
    Successfully opened the serial port /dev/ttyUSB0
    Submitted AT command: AT+CMGF=1
    
    OK
    
    Submitted AT command: AT+CGREG?
    
    +CGREG: 0,0
    
    OK
    
    Submitted AT command: AT+CUSD=1,"*144#",15
    
    ERROR
    
    Submitted AT command: ATi6
    
    Manufacturer: huawei
    Model: E160
    Revision: 11.609.06.02.94
    IMEI: 351596037574078
    +GCAP: +CGSM,+DS,+ES
    
    OK
    
    nmvictor@nmvictors-linuxbox:~$
    I wish this could work, Im so close with my application, save for this part.

  4. #4
    Super Grandmaster ginggs's Avatar
    Join Date
    Jun 2006
    Location
    Good-w00t! Cape Town
    Posts
    7,710

    Default

    Quote Originally Posted by nmvictor View Post
    Manufacturer: huawei
    Model: E160
    Aha! This modem requires USSD commands to be PDU encoded. I'll post some info if I can find it.
    Take it away, GreGorGy!
    Last edited by ginggs; 31-08-2011 at 03:06 PM.

  5. #5
    Grandmaster
    Join Date
    Jan 2005
    Location
    Jo†⊃u☞g
    Posts
    3,982

    Default

    I have posted this before but can't find where. Here is a little bit about PDUs.

    Lemme quickly find the PDU for *141#

    EDIT: found
    AT+CUSD=1,"AA182C3602",15
    Last edited by GreGorGy; 31-08-2011 at 12:35 PM.
    ★ mAcme for Mac OS X & 3G modems
    MY BLOED IS BLOU!
    Visit my friends

  6. #6
    Grandmaster
    Join Date
    Jan 2005
    Location
    Jo†⊃u☞g
    Posts
    3,982

    Default

    For *144#, use:

    AT+CUSD=1,"AA188D3602",15


    I have a quick PHP script that goes PDU <==> Text but cannot vouch for its accuracy or anything else - haven't even bothered refactoring the code so its just a quick thing that might help. Save as a PHP (dopdu.php) and run from browser.

    Code:
    <?php
    $PDUin = "";
    $PDUout = "";
    if (isset($_REQUEST["PDUin"]))
    	{
    	$PDUin = $_REQUEST["PDUin"];
    	}
    if ($PDUin != "")
    	{
    	$PDUout = '<BR>Last PDU=<B>'.PtoT($PDUin).'</B>';
    	}
    	
    $Textin = "";
    $Textout = "";
    if (isset($_REQUEST["Textin"]))
    	{
    	$Textin = $_REQUEST["Textin"];
    	}
    if ($Textin != "")
    	{
    	$Textout = '<BR>Last Text=<B>'.TtoP($Textin).'</B>';
    	}
    
    function PtoT($pdu)
    	{
    	$hexlen = (strlen($pdu)/2) - 1;
    	$hexes = array();
    	for ($i = 0; $i <= $hexlen; $i++)
    		{
    		$hexes[] = substr("00000000".base_convert((substr($pdu,($i*2), 2)),16,2),-8);
    		}
    	$LeftOver = "";
    	$Take = 7;
    	$FullBin = "";
    	for ($i=0 ; $i<= $hexlen ; $i++)
    		{
    		$rhs = 0 - $Take;
    		$FullBin .= substr($hexes[$i] , $rhs).$LeftOver;
    		$lhs = 8-$Take;
    		$LeftOver = substr($hexes[$i] ,0, $lhs);
    		$Take = $Take-1;
    		if ($Take == 0) {$Take = 7;}
    		if (strlen($LeftOver) == 7)
    			{
    			$FullBin .= $LeftOver;
    			$LeftOver = "";
    			}
    		}
    	$chrnum = array();
    	while ($FullBin != "")
    		{
    		$chrnum[] = chr(bindec(substr($FullBin,0,7)));
    		$FullBin = substr($FullBin,7);
    		}
    	
    	return implode("",$chrnum);
    	}
    
    function TtoP($text)
    	{
    	$bins = str_split($text);
    	foreach ($bins as $k=>$v)
    		{
    		$bins[$k] = substr("0000000".base_convert(ord($v),10,2) , -7);
    		}
    	$hexes = array();
    	$maxbins = count($bins) - 1;
    	for ($i = 0 ; $i <= $maxbins ; $i++)
    		{
    		if ($i == $maxbins)
    			{
    			$hexes[] = substr("00000000".$bins[$i] , -8);
    			}
    		else
    			{
    			$hl = strlen($bins[$i]);
    			if ($hl > 0)
    				{
    				$steal = $hl - 8;
    				$hexes[] = substr($bins[$i+1],$steal).$bins[$i];
    				$bins[$i+1] = substr($bins[$i+1],0,7+$steal);
    				}
    			}
    		}
    	$pdu = array();
    	foreach ($hexes as $v)
    		{
    		if ($v != "00000000")
    		{ $pdu[] = substr("0".strtoupper(base_convert($v, 2, 16)),-2); }
    		}
    	return implode("", $pdu);
    	}
    
    ?>
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    	"http://www.w3.org/TR/html4/loose.dtd">
    <HTML LANG="en">
    <HEAD>
    	<META HTTP-EQUIV=CONTENT-TYPE CONTENT="text/html; charset=utf-8">
    	<TITLE>PDU in and out</TITLE>
    	<META NAME="generator" CONTENT="BBEdit 9.6">
    </HEAD>
    <BODY>
    <FORM METHOD="post" ACTION="dopdu.php">
    Enter PDU:<BR>
    <TEXTAREA NAME="PDUin" ROWS=5 COLS=50><?php echo $PDUin; ?></TEXTAREA><?php echo $PDUout; ?><BR><BR>
    Enter TEXT:<BR>
    <TEXTAREA NAME="Textin" ROWS=5 COLS=50><?php echo $Textin; ?></TEXTAREA><?php echo $Textout; ?><BR><BR>
    <INPUT TYPE="submit" VALUE="Decode / Encode">
    </FORM>
    
    </BODY>
    </HTML>
    ★ mAcme for Mac OS X & 3G modems
    MY BLOED IS BLOU!
    Visit my friends

  7. #7

    Default

    I have tried with both this codes:

    AT+CUSD=1,"AA182C3602",15
    and
    AT+CUSD=1,"AA188D3602",15
    and it works but only gets me the OK response. Thanks for that, however, I am still not getting the Current balance response, despite keeping the code that checks & fetches the response in a while loop that lasts 2 mins. Is their a step am missing? JJust to mention, I am coding with java.
    Last edited by nmvictor; 31-08-2011 at 02:39 PM.

  8. #8
    Grandmaster
    Join Date
    Jan 2005
    Location
    Jo†⊃u☞g
    Posts
    3,982

    Default

    I want you to consider the following session, bearing in mind that Huaweis do send unsolicited data all the time (for diagnostics, etc). I am on Cell C and will send the USD *101# (check balance). Things in BOLDRED are instructions I am sending to the modem. Things in BOLDGREEN are the modems direct responses to my commands.

    ATI

    Manufacturer: huawei
    Model: E1820
    Revision: 11.831.03.00.00
    IMEI: --
    +GCAP: +CGSM,+DS,+ES

    OK


    ^BOOT:31355834,0,0,0,99

    at+cusd=1,"AA182C3602",15

    OK

    ^CSNR:-99,-14

    ^RSSI:9

    +CUSD: 0,"C2303BEC1E97413D90140473C1602050110F4FCBF320729 85ED6C1622F58EC2583CD602EA3BC5C0611C3F430A80792E16 4AE180CD414BA1A",15

    ^CSNR:-99,-14

    ^RSSI:9


    Look at the blue - unsolicited stuff. That bold blue line starting +CUSD is the response from the operator to my USSD, which you need to pick up. See that rubbish in the "" - it is a PDU response. My php page translates that as:

    Balance = R 0.00 Expiry date:01/01/2030.Free Data = 282.10 MB.

    See how the month-end balance on cell c is used up
    ★ mAcme for Mac OS X & 3G modems
    MY BLOED IS BLOU!
    Visit my friends

  9. #9

    Default

    Thanks, I got all your saying and I appreciate you information. I apologize for my nagging, but my real problem seems to be picking the bold blue line, which is the operators response to my USSD command, I am only able to pick the green responses from the modem. Please help me past this, and thanks in advance for your patience with me.

  10. #10
    Grandmaster
    Join Date
    Jan 2005
    Location
    Jo†⊃u☞g
    Posts
    3,982

    Default

    Hi nmvictor

    I am unfamiliar with java and therefore cannot answer how you would do this. Do you get those unsolicited responses at all? In my app, I tell it to read every line of information from the modem. If the line matches an instruction I have sent, I discard it. If the line matches the information codes (RSSI, BOOT, DSFLOW, etc) I handle it accordingly. If the line starts with a response I am expecting from, say, a USSD, I look out for the line beginning "+CUSD" and then I split it into an array based on the comma. From that array, I find the response and handle it.

    ginggs and I have both suffered through this process so we have the patience but not necessarily the complete know how for your programming situation.
    ★ mAcme for Mac OS X & 3G modems
    MY BLOED IS BLOU!
    Visit my friends

  11. #11

    Default

    Quote Originally Posted by GreGorGy View Post
    Do you get those unsolicited responses at all?
    Thanks again.To answer the above question, I'd say No. I don't get unsolicited responses in normals situation, when I send a command, in my case its the modem response that gets back. The responses prefixed with ^ don't show, I don't know if its because I'm not letting the thread run long enough to capture them, but like I said, I have the check and fetch code wrapped in a while loop to run for 2 mins, reading every possible line and if any, appending it to a StringBuilder. I could try to make the time longer and get back with the results. On the other hand, are the unsolicited response a feature that could be disabled? Please let me know. Thanks a lot GreGorGy, and ginggs, I am not taking your patience for granted.

  12. #12
    Grandmaster
    Join Date
    Jan 2005
    Location
    Jo†⊃u☞g
    Posts
    3,982

    Default

    You're definitely gonna have to give it a little longer to respond. To disable the ^ responses Huawei only:

    Code:
    AT^CURC=0
    (=1 reenables)

    Greg
    ★ mAcme for Mac OS X & 3G modems
    MY BLOED IS BLOU!
    Visit my friends

  13. #13

    Default

    Hi, I have been doing some Goooogling and I stumbled upon some info that Huawei modems attach to 3 ports[http://ubuntuforums.org/showthread.php?t=1017630&page=3 See the last post on that thread], in case of linux (/dev/ttyUSB0, /dev/ttyUSB1 and /dev/ttyUSB2). I have tried opening these ports and sending commands to the three ports and they all work save for /dev/ttyUSB2. Either way, I have an extra port, Im thinking I could have a thread monitoring /dev/ttyUSB1 for these "unsolicited responses and anything from the network, then have /dev/ttyUSB0 for normal AT commands and responses operation. Am telling you all these just in case you have a better suggestion. Back to coding, I'll check in just in case you post that suggestion or anything new. I appreciate your help through this, I nagged a lot but bottom-line, I am learning more which I owe to you and your patience. Thanks again.
    Last edited by nmvictor; 31-08-2011 at 05:18 PM.

  14. #14

    Default

    Hie people i need i best modem for my internate caffe how do i get it?

  15. #15
    Grandmaster
    Join Date
    Jan 2005
    Location
    Jo†⊃u☞g
    Posts
    3,982

    Default

    Quote Originally Posted by thandabantu View Post
    Hie people i need i best modem for my internate caffe how do i get it?
    yuu bye it att the voddacom shoppe.

    You will find this an expensive way to run an internate caffe
    ★ mAcme for Mac OS X & 3G modems
    MY BLOED IS BLOU!
    Visit my friends

Tags for this Thread

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •