Changeset 3728
- Timestamp:
- 06/05/2012 06:53:38 PM (12 months ago)
- Files:
-
- 1 modified
-
openbts/trunk/CLI/CLI.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
openbts/trunk/CLI/CLI.cpp
r3691 r3728 283 283 } 284 284 285 int isIMSI(const char *imsi) 286 { 287 int i = 0; 288 289 if (!imsi) 290 return 0; 291 if (strlen(imsi) != 15) 292 return 0; 293 294 for (i = 0; i < strlen(imsi); i++) { 295 if (!isdigit(imsi[i])) 296 return 0; 297 } 298 299 return 1; 300 } 285 301 286 302 /** Submit an SMS for delivery to an IMSI. */ 287 303 int sendsimple(int argc, char** argv, ostream& os) 288 304 { 289 if (argc!=3) return BAD_NUM_ARGS; 290 291 os << "enter text to send: "; 292 char txtBuf[161]; 293 cin.getline(txtBuf,160,'\n'); 305 if (argc<4) return BAD_NUM_ARGS; 306 294 307 char *IMSI = argv[1]; 295 308 char *srcAddr = argv[2]; 309 string rest = ""; 310 for (int i=3; i<argc; i++) rest = rest + argv[i] + " "; 311 const char *txtBuf = rest.c_str(); 312 313 if (!isIMSI(IMSI)) { 314 os << "Invalid IMSI. Enter 15 digits only."; 315 return BAD_VALUE; 316 } 296 317 297 318 static UDPSocket sock(0,"127.0.0.1",gConfig.getNum("SIP.Local.Port")); … … 312 333 sock.write(buffer); 313 334 335 os << "message submitted for delivery" << endl; 314 336 315 337 #if 0 … … 326 348 } 327 349 328 329 350 /** Submit an SMS for delivery to an IMSI. */ 330 351 int sendsms(int argc, char** argv, ostream& os) 331 352 { 332 if (argc!=3) return BAD_NUM_ARGS; 333 334 os << "enter text to send: "; 335 char txtBuf[161]; 336 cin.getline(txtBuf,160,'\n'); 353 if (argc<4) return BAD_NUM_ARGS; 354 337 355 char *IMSI = argv[1]; 338 356 char *srcAddr = argv[2]; 357 string rest = ""; 358 for (int i=3; i<argc; i++) rest = rest + argv[i] + " "; 359 const char *txtBuf = rest.c_str(); 360 361 if (!isIMSI(IMSI)) { 362 os << "Invalid IMSI. Enter 15 digits only."; 363 return BAD_VALUE; 364 } 339 365 340 366 Control::TransactionEntry *transaction = new Control::TransactionEntry( … … 741 767 addCommand("exit", exit_function, "[wait] -- exit the application, either immediately, or waiting for existing calls to clear with a timeout in seconds"); 742 768 addCommand("tmsis", tmsis, "[\"clear\"] or [\"dump\" filename] -- print/clear the TMSI table or dump it to a file."); 743 addCommand("sendsms", sendsms, " <IMSI> <src> -- send direct SMS to <IMSI>, addressed from <src>, after prompting.");744 addCommand("sendsimple", sendsimple, " <IMSI> <src> -- send SMS to <IMSI> via SIP interface, addressed from <src>, after prompting.");769 addCommand("sendsms", sendsms, "IMSI src# message... -- send direct SMS to IMSI, addressed from source number src#."); 770 addCommand("sendsimple", sendsimple, "IMSI src# message... -- send SMS to IMSI via SIP interface, addressed from source number src#."); 745 771 //apparently non-function now -kurtis 746 772 //addCommand("sendrrlp", sendrrlp, "<IMSI> <hexstring> -- send RRLP message <hexstring> to <IMSI>.");
![(please configure the [header_logo] section in trac.ini)](http://wush.net/trac/rangepublic/raw-attachment/wiki/WikiStart/PublicReleaseLogo.png)
