How to send USSD codes?

Login to reply to this topic.
Wed, 2006-03-22 16:50
Joined: 2005-12-14
Forum posts: 14
Hi,

does somebody know how to send USSD codes in symbian c++?

I've tried to make a normal call but it doesn't work.
I've tried to send AT commands to the modem but it doesn't work.

Any idea?Huh

Thanks.

Thu, 2006-03-23 03:45
Joined: 2004-11-02
Forum posts: 52
A C&P from DevLib
USSD messaging

The Unstructured Supplementary Service Data (USSD) service provided by GSM/ WCDMA networks transmits information over the network's signalling channels.

USSD has been placed within the messaging functionality because of its potential use as a bearer for WAP or other overlying protocol. The USSD protocol is therefore suitable for implementation within a Sockets protocol (.PRT) module.

RMobileUssdMessaging allows clients to:

- open a USSD messaging sub-session using RMobileUssdMessaging::Open()

- get capabilities using RMobileUssdMessaging::GetCaps(). Capabilities are encapsulated in a packaged RMobileUssdMessaging::TMobileUssdCapsV1 object.

- wait for the next incoming USSD message using RMobileUssdMessaging::ReceiveMessage()

- send a UUSD message using RMobileUssdMessaging::SendMessage()

Example

The following code gets in aMessageData the contents, and in aUssdAtts the attributes, of the next USSD message received.
Code:
void CClientApp::ReceiveUssdMessageL(
    RMobileUssdMessaging::TGsmUssdMessageData& aMessageData,
    RMobileUssdMessaging::TMobileUssdAttributesV1& aUssdAtts)
    {
    // Open session
    RMobileUssdMessaging ussdSession;
    User::LeaveIfError(ussdSession.Open(iMobilePhone));
    CleanupClosePushL(ussdSession);

    // Get ussd capabilities
    RMobileUssdMessaging::TMobileUssdCapsV1 ussdCaps;
    RMobileUssdMessaging::TMobileUssdCapsV1Pckg ussdCapsPckg(ussdCaps);
    User::LeaveIfError(ussdSession.GetCaps(ussdCapsPckg));

    // Test if USSD messages can be received
    if (ussdCaps.iUssdTypes & RMobileUssdMessaging::KCapsMTUssd)
        {
        // Get the next received Ussd message
        RMobileUssdMessaging::TMobileUssdAttributesV1Pckg ussdAttsPckg(aUssdAtts);
        TRequestStatus status;
        ussdSession.ReceiveMessage(status, aMessageData, ussdAttsPckg);
        User::WaitForRequest(status);
        User::LeaveIfError(status.Int());
        }
     
    // Clean up
    CleanupStack::PopAndDestroy(); // calls ussdSession.Close()
    }

NewLC #2150

Thu, 2006-03-23 15:39
Joined: 2005-12-14
Forum posts: 14
Re: How to send USSD codes?
Hi,

i could send ussd codes using AT commands, despite i would like to know how can i access to the description of this library, because it's not public.

thanks,
bye.
Tue, 2006-03-28 00:58
Joined: 2003-11-04
Forum posts: 63
Re: How to send USSD codes?
I am having problems sending a USSD message, here is the code I am using :

Code:
User::LeaveIfError(ussdSession.Open(iMobilePhone));
CleanupClosePushL(ussdSession);

RMobileUssdMessaging::TGsmUssdMessageData aMessageData;
RMobileUssdMessaging::TMobileUssdAttributesV1 aUssdAtts;

// fill in message and attributes
aMessageData.Copy(_L8("#999#"));

aUssdAtts.iFlags = 0;
aUssdAtts.iFormat = 0;
aUssdAtts.iType = 0;
aUssdAtts.iDcs = 0;

RMobileUssdMessaging::TMobileUssdAttributesV1Pckg ussdAttsPckg(aUssdAtts);
TRequestStatus status;

ussdSession.SendMessage(status, aMessageData, ussdAttsPckg);
User::WaitForRequest(status);
User::LeaveIfError(status.Int());

CleanupStack::PopAndDestroy(); // calls ussdSession.Close()

I am not sure what the attributes should be set to and I get the Error Etel Client Fault 8. Do I need to open the RMobilePhone before calling Open in the RMobileUssdMessaging class ?   Huh  Please Help
Tue, 2006-03-28 09:08
Joined: 2005-12-14
Forum posts: 14
Re: How to send USSD codes?
Hi,

i use AT commands to send USSD codes and it works, if you prefer to use this way post me.

Bye.
Benji.
Tue, 2006-03-28 17:43
Joined: 2003-11-04
Forum posts: 63
Re: How to send USSD codes?
Are you able to get the response as well ?
Tue, 2006-03-28 18:40
Joined: 2005-12-14
Forum posts: 14
Re: How to send USSD codes?
Hi,

i can get the AT command response but it's the code sent if successful.

The message received from the operator is shown directly by the OS and the application cannot capture it.

bye.
Tue, 2006-03-28 19:32
Joined: 2003-11-04
Forum posts: 63
Re: How to send USSD codes?
Yeah I need the response coming back.


Thanks.
Tue, 2006-03-28 19:54
Joined: 2003-11-04
Forum posts: 63
Re: How to send USSD codes?
On second thought could you post that code, or send it to me ?
Wed, 2006-03-29 08:57
Joined: 2005-12-14
Forum posts: 14
Re: How to send USSD codes?
Hi,

here you are:

User::LeaveIfError(StartC32()); //Arrancamos el servidor de comm
   
   RCommServ commServer;
   CleanupClosePushL( commServer );
   User::LeaveIfError(commServer.Connect());
    
   _LIT(KCsyName, "dataport");
   User::LeaveIfError(commServer.LoadCommModule(KCsyName));

   _LIT(KDataPort, "DATAPORT::1");
   TBuf<20> port(KDataPort);
   RComm commW;
   CleanupClosePushL( commW );

   User::LeaveIfError(commW.Open(commServer, port, ECommShared));
   
   TBuf8<128> atCommand;
   atCommand.Append(_L8("AT+CUSD=1,\""));
   atCommand.Append(aUssdCode);
   atCommand.Append(_L8("\",15\r\n"));
   
   TRequestStatus callStatus;
   commW.Write(callStatus, atCommand);
   User::WaitForRequest(callStatus);
   User::After(1000);
   
   if(callStatus.Int() == KErrNone)
   {
      TBuf8<128> replyBuf;
      commW.Read(callStatus, TTimeIntervalMicroSeconds32(1000000), replyBuf);
         
      HBufC* msg = HBufC::NewL(replyBuf.Length()*2);
      (msg->Des()).Copy(replyBuf);

      User::LeaveIfError(replyBuf.Compare(atCommand)==0);      
   }else
   {
      User::Leave(callStatus.Int());
   }
      
   CleanupStack::PopAndDestroy( &commW );
   CleanupStack::PopAndDestroy( &commServer );
Wed, 2006-03-29 17:15
Joined: 2003-11-04
Forum posts: 63
Re: How to send USSD codes?
Thanks.
Wed, 2006-04-05 22:21
Joined: 2003-11-04
Forum posts: 63
Re: How to send USSD codes?
Got that to work, how do you dismiss the global note that comes up in response to the ussd command ?
Thu, 2006-04-06 09:35
Joined: 2005-12-14
Forum posts: 14
Re: How to send USSD codes?
I think you cannot but i'm not sure.

bye.
Tue, 2006-05-09 18:18
Joined: 2005-11-14
Forum posts: 12
Re: How to send USSD codes?
Hi,

I have tried SSUU code for receiving USSD messages and it works. I have made a similar code for sending USSD messages but I get a -6 (Bad Request) error in the status variable after sending the message. Do I have to use special Ussd attributes?? Any idea??

Thanks
Thu, 2008-11-20 03:10
Joined: 2008-11-20
Forum posts: 1
how can I get header file and lib file of RMobileUssdMessaging?

comipler report many errors when I am trying ssuu's code,anybody can tell me how to get it ?

  • Login to reply to this topic.