Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to make a phone Call? #9

Closed
thuyenvinh opened this issue Jun 21, 2021 · 11 comments
Closed

How to make a phone Call? #9

thuyenvinh opened this issue Jun 21, 2021 · 11 comments

Comments

@thuyenvinh
Copy link

Hi all!
How to Make a Phone Call and detect when phone is answered or rejected...?

@hbjorgo
Copy link
Owner

hbjorgo commented Jun 24, 2021

Hi!
You want to make a call from this library to another device? That is currently not implemented, but if that's something you're interested in, I can implement it. Receiving a call through the library works fine.

@thuyenvinh
Copy link
Author

yes! please implement it

@hbjorgo
Copy link
Owner

hbjorgo commented Jun 30, 2021

Hi
Please check out the latest release:
https://github.com/hbjorgo/ATLib/releases/tag/3.0.0
I hope this is what you're looking for 😃 Please let me know if you experience any issues 👌🏼

@hbjorgo
Copy link
Owner

hbjorgo commented Jul 5, 2021

Have you had a chance to try it out? Register on the OnCallEnded event and dial the number. In the event you'll get the call details which includes the call duration.

@thuyenvinh
Copy link
Author

It would be good if you add Send USSD function!

@hbjorgo
Copy link
Owner

hbjorgo commented Jul 9, 2021

Thank you, I'm looking into it!

@thuyenvinh
Copy link
Author

thuyenvinh commented Jul 12, 2021

here my function
public virtual async Task SendUSSDAsync(string ussdComand, string dcs = "15")
{
(AtError error, AtResponse response) = await channel.SendFullCommandAsync($"AT+CUSD=1,"{ussdComand}",{dcs}", AtCommandType.MULTILINE, "+CUSD:", null,TimeSpan.Zero);
if (error == AtError.NO_ERROR)
{
StringBuilder builder = new StringBuilder();
foreach (string line in response.Intermediates)
{
builder.AppendLine(line);
}
return builder.ToString();
}
return null;
}
thank you!

@hbjorgo
Copy link
Owner

hbjorgo commented Jul 12, 2021

Thank you for your code example!

I'm trying to get USSD responses on my network, but it looks like they don't offer any. I only get negative responses. Could you provide me with some real request/responses?

Example:

Request:
AT+CUSD=1,"*100#",15
Response:
OK
+CUSD: 1,"Your balance is 100",15

Etc. Is +CUSD: response always a single line?

@hbjorgo hbjorgo reopened this Jul 12, 2021
@thuyenvinh
Copy link
Author

add this code
case ConsoleKey.U:
var rsUssd = await modem.SendUSSDAsync("*101#");
Console.WriteLine($"Ussd: {rsUssd}");
break;

here result...

Opening serial port...
Serialport opened
SIM Status: SIM_READY
Signal Strength: RSSI: 17, BER: 99
Battery Status: Charge Status: Powered by battery, Charge Level: 100%
Product Information:
Manufacturer: ZTE CORPORATION
Model: MF190
Revision: BD_MF190V1.0.0B02
IMEI: 863403019673989
+GCAP: +CGSM,+DS,+ES
Setting date and time: OK
Date and time:
Setting SMS text format: OK
Setting new SMS indication: OK
Single SMS:
Done. Press 'a' to answer call, 'd' to dial, 'h' to hang up, 's' to send SMS and 'q' to exit...
uUssd:
+CUSD: 0,"00560049004E00410043004100520044002E00200054004B0020006300680069006E0068003D0031003500300035003900200056004E0044002C0020004B004D003D003000200056004E0044002C0020004B004D0031003D003000200056004E0044002C0020004B004D0032003D003000200056004E0044002C0020004B004D0033003D003000200056004E0044002C00200044004B0032003D003000200056004E0044002E002000480061006E002000730075002000640075006E0067002000300038002F00300039002F0032003000320031",72

@hbjorgo
Copy link
Owner

hbjorgo commented Jul 13, 2021

Thank you for your sample response.

Please check out the latest release: 3.1.0
Use the method "SendUssdAsync", and you'll get the response in the "UssdResponseReceived" event.
I also included a UCS2 decoder :)

@thuyenvinh
Copy link
Author

thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants