SMS auto respond + call status


#1

Hi !

Im changing status of the call each time i get a call.
Status has two values and the values are changed on call.
When the call status is changed i send sms as confirmation.

I have made and tested the sms part but now i want to make all this automaticly. The problem is with defining sms auto respond. When the call is recieved i set status and at this point i want to replay to sender but i can’t.
I need to make manual input…


#2

What exactly is your problem?

Use the ADL Call Service for the calls, and the SMS Service for SMS…


#3

Perhaps you also need to look-up AT+CLIP in the AT Commands manual…?

and that would require the ADL AT Commands service…


#4

Maybe it would be better if i write some additional details about what im doing :stuck_out_tongue:
My modul: q2686h.
OpenAT: 4.10.10

Im setting 3 gpio’s ( two inputs and one output ).

The input gpio is used for switching events and sending sms confirmation based on call event. After i get ADL_CALL_EVENT_RING_DATA == OK im setting gpio as input or output, based on the last event and am sending sms as confirmation. Last event is changed on call or per sms.
At the moment am in the part of compleating the input gpio function.

I have defined sms.c as external file and gpio handle is set under main file. Sms and input gpio ( gpio trace is trowing -2, but…) are working, if i try to run them separatly.

If i try to call adl_simSubscribe(SimHandler,NULL) and make auto replay to sender, right after i get RING_DATA i can see a trace but thats it.
There is no auto respond. Program stops at trace. ?

If you need the code please let me know, so i can send it.

Emil


#5

I don’t understand you - what does that actually mean?


#6

It means that on each incomming call sended to q2686 i have to make respond to caller, with sms.

After i get ADL_CALL_EVENT_RING_DATA == OK i set input OR output ( based on last defined event ).

If the last defined event is INPUT then you get two additional options… ON/OFF. This ON/OFF options are changed automaticly each time you enter INPUT part. First call is ON, second call is OFF and so on. Each time you make change in input or output part you get sms confirmation that the change is accepted.

Partly typical example would be those free calls (some show etc. )
You call, you get voice answer from the mashine “your call is registered” and the line is hanged up.

I want to make partly the same but instead voice answer i want to send sms to the original caller.

example for input:
ADL_CALL_EVENT_RING_DATA == OK

  • if gpio is input
  • read second handler last state
  • if last state from second handler == ON
  • set new state for second handler == OFF
  • send confirmation SMS to caller that the new state is OFF

Emil


#7

So what exactly is your problem?

Use AT+CLIP to get the caller’s number;
Use the ADL Call Service to handle the call;
Use the ADL SMS Service to send the text message.

Where is your problem?


#8

Hello.

Someone can call and hangup but i have to send SMS.
Someone can send SMS but i have to make replay with defined SMS.

Defined SMS’s are : Thank you for your call.
Defined SMS’s are : Thank you for your SMS.
In both cases i have to send sms.

My exact problem is that i can’t, or dont know how to make replay to sender. If user makes voice or data call i get this:

i see that SMS service is started but to replay i have to manualy write: AT+CMGS=3851234567 … and manualy hangup the line.

Additional problem is in different networks.

Example:

and the same text from other network:


Shorted SMS code:

************************************************************************
					void smsTimerHandler(u8 ID){
					   adl_atSendResponse ( ADL_AT_UNS, buff );
					}
					//---------------------------------------------------------------------------
					bool SMSHandler (ascii *SmsTel, ascii *SmsTimeLength, ascii *SmsText){
					   wm_sprintf(buff, "\r\n+SMS: %s\n\r%s\r\n", SmsTel, SmsText);
					   adl_tmrSubscribe(FALSE,10,ADL_TMR_TYPE_100MS,smsTimerHandler);
					   return TRUE;
					}
					//----------------------------------------------------------------------------
					void smsConHandler (u8 Event, u16 Nb){
					   switch(Event){
					     case ADL_SMS_EVENT_SENDING_OK: 
					     	adl_atSendResponse ( ADL_AT_UNS, "\n\rSMS Error\n\r" );
					     break;
					   }
					}
					//-----------------------------------------------------------------------------
					void sendSms (adl_atCmdPreParser_t * paras){		
					   ascii * phone;
					   ascii * text;
					   char poruka[15];
					   phone = ADL_GET_PARAM(paras,0);
					   text  = ADL_GET_PARAM(paras,1);
					   adl_smsSend(Handle,phone,text,ADL_SMS_MODE_TEXT);
					}
					//------------------------------------------------------------------------------
					void smsInit(){
					   Handle = adl_smsSubscribe(SMSHandler,smsConHandler,ADL_SMS_MODE_TEXT);
					   adl_atCmdSubscribe	("at+sndsms",sendSms,ADL_CMD_TYPE_PARA|0x0022);
					   adl_atSendResponse	( ADL_AT_UNS, "\n\r Sms servis pokrenut\n\r");
					}
					//------------------------------------------------------------------------------
					void SimHandler (u8 Event){
					   switch(Event){
					  	 case ADL_SIM_EVENT_PIN_ERROR:    
					  	 	adl_atSendResponse ( ADL_AT_UNS, "Krivi pin\n\r"); 
					  	 break;
					   	 case ADL_SIM_EVENT_PIN_WAIT:
					   	   adl_atSendResponse ( ADL_AT_UNS, "Unesi PIN:\n\r");
					   	 break;
					   }
					}
					
					adl_simSubscribe(SimHandler,NULL);
					
					//*******************************************************

#9

Actually, the word is “reply”

I still don’t see the problem:

AT+CLIP gives you the caller’s number as soon as you get an incoming ring - so all you have to do to reply is send the SMS to that number.
Where’s the problem?

The ADL SMS Service passes the sender’s number as the 1st parameter to the Handler - so all you have to do to reply is send the SMS to that number.
Where’s the problem?


#10

Thank you for your correction i didn’t notice this.

Now, after drinking cup of good old china green tee, lets take a look…

My problem is not in caller ID. Look at the shorted SMS code.

The code execution in emulator goes like this:
-App started.
-LCD ON
-PIN OK
-RING
+CLIP=0,1
-Hangup
SMS started (Sms servis pokrenut)

  • at this point SMS reply to sender and ADL_SMS_EVENT_SENDING_OK should appear but nothing happens and i have to make manual input (CMGS) *
  • If the upper part would be executed OK i would trigger sms unsubscribe and that’s it.

To ask this super simple and without any additional details:
After you have look at the code, tell me how would you call sms function in openAT, and make reply to sender at this upper defined point ?


#11
// SMS Handler: Send a reply to a received text message.
//
// This is called automatically whenever an SMS is received.
//
// The parameters give the sender's number, the timestamp, and the text.
// So, to reply to the sender, we just have to use these parameters!
//
bool SMSHandler( ascii *SmsTel, ascii *SmsTimeLength, ascii *SmsText )
{ 
   adl_smsSend( Handle,              // The handle from your SMS Subscription
                SmsTel,              // The caller's number
                "This is my reply",  // The message to send
                ADL_SMS_MODE_TEXT ); // Use text mode
   return TRUE; 
}

Simple as that.

(you should, of course, check the return value from adl_smsSend)


#12

This tells you that CLIP (Calling Line ID Presentation) is disabled.

If it’s disabled, the Calling Line ID (ie, the calling number) will not be Presented!

If the Calling Line ID is not Presented, you don’t know what it is - so you can’t reply to it, can you?! :unamused:


#13

I put this just as example.

Thank you for your reply. I will try this.


#14

Hi, I am doing an aplication wich after receiving an sms must reply back to the same number
Any help will be apreciated
Thank you


#15

Start by reading about the SMS Service in the ADL User Guide - look at what parameters are provided to the incoming message handler…


#16

I read the SMS service documentation but i didn’t understand how the SMS subscription works
anyone have an example of using adl_smsSubscribe function with adl_smsSend.
thank you


#17

What don’t you understand about it?

Have you looked at the examples that are installed with the SDK?


#18

Finally it worked. Thank you for your help!