1

I'm writing an app which can test different SMSC (Short Message Service Centers) from an operator. Therefore I need to change the SMSC the iPhone is using for sending SMS. Is there a way doing this ?

Android offers an sendMessage method with the SMSC as an parameter, is there a equivalent in iOS ? I don't care if it's using private API Calls since I won't release my app anyway (just for internal testing purposes). Any help appreciated, thanks.

Nexus2k
  • 345
  • 1
  • 4
  • 13
  • For an alternative it could be the code for changing the SMSC the iPhone is using instead of directly sending over a different SMSC. – Nexus2k Mar 23 '12 at 16:19
  • Another alternative would be to Call **5005*7672*SMSCNUMBER# in Background, is there such a thing within the private API's ? – Nexus2k Mar 26 '12 at 14:15

2 Answers2

7

This solution works on non-jailbroken phones, but it will not get in the app store. It uses private API's and it's very similar your description of Android's sendMessage.

You'll have to link your project the CoreTelephony framework (public now), and create the header described bellow. There's and example included too.

CTMessageCenter.h:

#import <Foundation/Foundation.h>

@interface CTMessageCenter : NSObject
{
}

+ (id)sharedMessageCenter;
- (id)init;
- (id)sendSMS:(id)fp8;
- (id)sendMMSFromData:(id)fp8 messageId:(unsigned int)fp12;
- (id)sendMMS:(id)fp8;
- (id)send:(id)fp8;
- (id)incomingMessageWithId:(unsigned int)fp8 telephonyCenter:(struct __CTTelephonyCenter *)fp12 isDeferred:(BOOL)fp16;
- (int)incomingMessageCount;
- (id)allIncomingMessages;
- (void)acknowledgeIncomingMessageWithId:(unsigned int)fp8;
- (void)acknowledgeOutgoingMessageWithId:(unsigned int)fp8;
- (id)incomingMessageWithId:(unsigned int)fp8;
- (id)deferredMessageWithId:(unsigned int)fp8;
- (id)statusOfOutgoingMessages;
- (id)encodeMessage:(id)fp8;
- (id)decodeMessage:(id)fp8;
- (BOOL)isMmsEnabled;
- (BOOL)isMmsConfigured;
- (BOOL)sendSMSWithText:(id)fp8 serviceCenter:(id)fp12 toAddress:(id)fp16;

@end

Example:

#import "CTMessageCenter.h"

BOOL success = [[CTMessageCenter sharedMessageCenter]  sendSMSWithText:@"test" serviceCenter:serviceCenterNumberAsString toAddress:numberAsString];
fbernardo
  • 10,016
  • 3
  • 33
  • 46
  • The original poster mentioned that he is using the application for personal use, and does not intend to submit to the app store. This being said, your answer isn't very constructive on answering his question. – brandonbocklund Mar 19 '12 at 22:00
  • @brandonbocklund Do you even read the answer? This a non approved way. My question is the jailbreak way to do it and it's exactly what he asked for. – fbernardo Mar 20 '12 at 00:27
  • @fbernardo Thank you for your quick reply. Just need to get accepted to the developer programm so I can test it on my phone. Will report back. – Nexus2k Mar 20 '12 at 10:42
  • it didn't work. well it did send sms indeed but completly ignored the serviceCenter Parameter. Have to try further with different Numberformats maybe it has problem with the international format (starting with +41) – Nexus2k Mar 22 '12 at 07:25
  • Nope seems that serviceCenter Parameter is completly ignored. So I'm still looking for a solution to programmatically change the SMSC... – Nexus2k Mar 23 '12 at 16:17
  • unfortunately just by entering the code **5005*7672*SMSCNUMBER# maybe a direct edit of the providersettings.plist files could help ? – Nexus2k Mar 25 '12 at 14:39
  • So, there is a file? Why don't you edit it directly then? Programmatically ofc. – fbernardo Mar 25 '12 at 15:28
  • I searched a little but found that there isn't a file. you have to change it by dialing the special number above. Is there a background call function in the private apis ? – Nexus2k Mar 26 '12 at 14:16
  • I'm sure there is, but doesn't that mean it's a carrier setting and not on the phone? – fbernardo Mar 26 '12 at 14:30
  • Initially the SMSC Number is taken out of the SIM Card. but when you can change it by numbercodes then there has to be a function or method to change it by programmcode aswell... and btw. calling the special number code out of my app doesn't work either, phone app doesn't show up, like there is a filter for special numbercodes or something – Nexus2k Mar 27 '12 at 06:53
  • @ThilinaCháminHewagama what do you mean by "does not work"? Error? Crashes? Does nothing? No logs? – fbernardo Oct 06 '13 at 19:00
  • That is about the above answer, that is not working for iOS7, no errors, no crashes but it does nothing :(. If you found any solution, please let me know – Thilina Chamath Hewagama Oct 07 '13 at 03:49
  • @ThilinaCháminHewagama Probably Apple changed it... You can try disassembling the Messages app or the CoreTelephony framework to find out the problem. – fbernardo Oct 11 '13 at 20:53
  • @ThilinaCháminHewagama It looks like the the headers have changed a bit in ios 7: https://github.com/EthanArbuckle/IOS-7-Headers/blob/master/Frameworks/CoreTelephony.framework/CTMessageCenter.h – Mr. T Jun 26 '14 at 23:59
2

You need to use AT Command to update SMSC on the SIM card.

On iOS, you can use Private Framework SKTelephonyController.

AT Command to get current SMSC on the SIM card: AT+CSCA?

Write to SIM card: AT+CSCA = "1xxxxxxxxxx",145

mikewen
  • 39
  • 4