Changeset 1246 for pjproject/trunk
- Timestamp:
- May 3, 2007 1:31:21 PM (18 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 3 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/build.symbian/pjlib.mmp
r1244 r1246 31 31 SOURCE rand.c 32 32 SOURCE rbtree.c 33 SOURCE timer.c34 33 SOURCE types.c 35 34 … … 38 37 // Platform dependent source 39 38 // 39 SOURCE compat\string_compat.c 40 40 SOURCE addr_resolv_symbian.cpp 41 41 SOURCE exception_symbian.cpp … … 43 43 SOURCE file_io_ansi.c 44 44 SOURCE guid_simple.c 45 SOURCE ioqueue_symbian.cpp 45 46 SOURCE ip_helper_generic.c 46 47 SOURCE log_writer_symbian_console.cpp … … 51 52 SOURCE os_timestamp_posix.c 52 53 SOURCE pool_policy_new.cpp 53 SOURCE compat\string_compat.c54 54 SOURCE sock_symbian.cpp 55 55 SOURCE sock_select_symbian.cpp 56 SOURCE ioqueue_symbian.cpp56 SOURCE timer_symbian.cpp 57 57 SOURCE unicode_symbian.cpp 58 58 -
pjproject/trunk/build.symbian/pjlib_util.mmp
r1244 r1246 58 58 SYSTEMINCLUDE \epoc32\include\libc 59 59 60 LIBRARY pjlib.lib61 60 CAPABILITY None 62 61 -
pjproject/trunk/build.symbian/pjproject.cww
r1244 r1246 165 165 <SESSION>-1</SESSION> 166 166 <EDOCTYPE>0</EDOCTYPE> 167 <PATH USERELATIVEPATHS = "true">pjsip_ua.mcp</PATH> 168 <FRAMELOC> 169 <X>548</X> 170 <Y>123</Y> 171 </FRAMELOC> 172 <FRAMESIZE> 173 <W>400</W> 174 <H>372</H> 175 </FRAMESIZE> 176 <DOCKINFO> 177 <STATUS>1</STATUS> 178 <ROW>0</ROW> 179 <COLUMN>0</COLUMN> 180 <DOCKBARID>59420</DOCKBARID> 181 <PCTWIDTH>1.000000</PCTWIDTH> 182 <HGT>294</HGT> 183 <GROUPID> 184 <GIDHIGHPART>4294967294</GIDHIGHPART> 185 <GIDLOWPART>4294967294</GIDLOWPART> 186 </GROUPID> 187 </DOCKINFO> 188 </WINDOW> 189 <WINDOW> 190 <SESSION>-1</SESSION> 191 <EDOCTYPE>0</EDOCTYPE> 192 <PATH USERELATIVEPATHS = "true">pjsip_simple.mcp</PATH> 193 <FRAMELOC> 194 <X>0</X> 195 <Y>0</Y> 196 </FRAMELOC> 197 <FRAMESIZE> 198 <W>347</W> 199 <H>128</H> 200 </FRAMESIZE> 201 <DOCKINFO> 202 <STATUS>1</STATUS> 203 <ROW>0</ROW> 204 <COLUMN>0</COLUMN> 205 <DOCKBARID>59420</DOCKBARID> 206 <PCTWIDTH>1.000000</PCTWIDTH> 207 <HGT>294</HGT> 208 <GROUPID> 209 <GIDHIGHPART>4294967294</GIDHIGHPART> 210 <GIDLOWPART>4294967294</GIDLOWPART> 211 </GROUPID> 212 </DOCKINFO> 213 </WINDOW> 214 <WINDOW> 215 <SESSION>-1</SESSION> 216 <EDOCTYPE>0</EDOCTYPE> 167 217 <PATH USERELATIVEPATHS = "true">pjsua_lib.mcp</PATH> 168 218 <FRAMELOC> … … 215 265 <SESSION>-1</SESSION> 216 266 <EDOCTYPE>1</EDOCTYPE> 217 <PATH USERELATIVEPATHS = "true">..\pjlib\src\pj\sock_symbian.cpp</PATH> 218 <FRAMELOC> 219 <X>8</X> 220 <Y>27</Y> 221 </FRAMELOC> 222 <FRAMESIZE> 223 <W>646</W> 224 <H>464</H> 267 <PATH USERELATIVEPATHS = "true">..\pjsip-apps\src\symbian_ua\ua.cpp</PATH> 268 <MAXIMIZED>true</MAXIMIZED> 269 <FRAMELOC> 270 <X>4</X> 271 <Y>4</Y> 272 </FRAMELOC> 273 <FRAMESIZE> 274 <W>605</W> 275 <H>778</H> 225 276 </FRAMESIZE> 226 277 <DOCKINFO> … … 238 289 </WINDOW> 239 290 <WINDOW> 240 <SESSION>- 1</SESSION>241 <EDOCTYPE> 1</EDOCTYPE>242 < PATH USERELATIVEPATHS = "true">..\pjsip-apps\src\symbian_ua\main_symbian.cpp</PATH>243 <FRAMELOC> 244 <X> 8</X>245 <Y>2 7</Y>246 </FRAMELOC> 247 <FRAMESIZE> 248 <W> 638</W>249 <H> 437</H>291 <SESSION>-2147483648</SESSION> 292 <EDOCTYPE>36</EDOCTYPE> 293 <DEFAULT>true</DEFAULT> 294 <FRAMELOC> 295 <X>4</X> 296 <Y>23</Y> 297 </FRAMELOC> 298 <FRAMESIZE> 299 <W>470</W> 300 <H>705</H> 250 301 </FRAMESIZE> 251 302 <DOCKINFO> … … 263 314 </WINDOW> 264 315 <WINDOW> 265 <SESSION>- 1</SESSION>266 <EDOCTYPE> 1</EDOCTYPE>267 < PATH USERELATIVEPATHS = "true">..\pjsip-apps\src\symbian_ua\ua.cpp</PATH>316 <SESSION>-2147483648</SESSION> 317 <EDOCTYPE>20</EDOCTYPE> 318 <DEFAULT>true</DEFAULT> 268 319 <FRAMELOC> 269 320 <X>4</X> … … 271 322 </FRAMELOC> 272 323 <FRAMESIZE> 273 <W> 565</W>274 <H> 643</H>324 <W>904</W> 325 <H>1791</H> 275 326 </FRAMESIZE> 276 327 <DOCKINFO> … … 288 339 </WINDOW> 289 340 <WINDOW> 290 <SESSION>- 1</SESSION>291 <EDOCTYPE> 1</EDOCTYPE>292 < PATH USERELATIVEPATHS = "true">..\pjlib\src\pj\ioqueue_symbian.cpp</PATH>293 <FRAMELOC> 294 <X> 10</X>295 <Y> 40</Y>296 </FRAMELOC> 297 <FRAMESIZE> 298 <W> 630</W>299 <H>4 10</H>341 <SESSION>-2147483648</SESSION> 342 <EDOCTYPE>23</EDOCTYPE> 343 <MAXIMIZED>true</MAXIMIZED> 344 <FRAMELOC> 345 <X>6</X> 346 <Y>81</Y> 347 </FRAMELOC> 348 <FRAMESIZE> 349 <W>566</W> 350 <H>477</H> 300 351 </FRAMESIZE> 301 352 <DOCKINFO> … … 312 363 </DOCKINFO> 313 364 </WINDOW> 314 <WINDOW>315 <SESSION>-1</SESSION>316 <EDOCTYPE>1</EDOCTYPE>317 <PATH USERELATIVEPATHS = "true">..\pjlib\src\pj\os_core_symbian.cpp</PATH>318 <FRAMELOC>319 <X>6</X>320 <Y>23</Y>321 </FRAMELOC>322 <FRAMESIZE>323 <W>638</W>324 <H>437</H>325 </FRAMESIZE>326 <DOCKINFO>327 <STATUS>0</STATUS>328 <ROW></ROW>329 <COLUMN></COLUMN>330 <DOCKBARID></DOCKBARID>331 <PCTWIDTH></PCTWIDTH>332 <HGT></HGT>333 <GROUPID>334 <GIDHIGHPART></GIDHIGHPART>335 <GIDLOWPART></GIDLOWPART>336 </GROUPID>337 </DOCKINFO>338 </WINDOW>339 <WINDOW>340 <SESSION>-1</SESSION>341 <EDOCTYPE>1</EDOCTYPE>342 <PATH USERELATIVEPATHS = "true">..\pjlib\src\pj\os_error_symbian.cpp</PATH>343 <FRAMELOC>344 <X>8</X>345 <Y>27</Y>346 </FRAMELOC>347 <FRAMESIZE>348 <W>638</W>349 <H>437</H>350 </FRAMESIZE>351 <DOCKINFO>352 <STATUS>0</STATUS>353 <ROW></ROW>354 <COLUMN></COLUMN>355 <DOCKBARID></DOCKBARID>356 <PCTWIDTH></PCTWIDTH>357 <HGT></HGT>358 <GROUPID>359 <GIDHIGHPART></GIDHIGHPART>360 <GIDLOWPART></GIDLOWPART>361 </GROUPID>362 </DOCKINFO>363 </WINDOW>364 <WINDOW>365 <SESSION>-1</SESSION>366 <EDOCTYPE>1</EDOCTYPE>367 <PATH USERELATIVEPATHS = "true">..\pjlib\src\pj\errno.c</PATH>368 <FRAMELOC>369 <X>4</X>370 <Y>23</Y>371 </FRAMELOC>372 <FRAMESIZE>373 <W>646</W>374 <H>464</H>375 </FRAMESIZE>376 <DOCKINFO>377 <STATUS>0</STATUS>378 <ROW></ROW>379 <COLUMN></COLUMN>380 <DOCKBARID></DOCKBARID>381 <PCTWIDTH></PCTWIDTH>382 <HGT></HGT>383 <GROUPID>384 <GIDHIGHPART></GIDHIGHPART>385 <GIDLOWPART></GIDLOWPART>386 </GROUPID>387 </DOCKINFO>388 </WINDOW>389 <WINDOW>390 <SESSION>-1</SESSION>391 <EDOCTYPE>20</EDOCTYPE>392 <MAXIMIZED>true</MAXIMIZED>393 <FRAMELOC>394 <X>0</X>395 <Y>0</Y>396 </FRAMELOC>397 <FRAMESIZE>398 <W>824</W>399 <H>1521</H>400 </FRAMESIZE>401 <DOCKINFO>402 <STATUS>0</STATUS>403 <ROW></ROW>404 <COLUMN></COLUMN>405 <DOCKBARID></DOCKBARID>406 <PCTWIDTH></PCTWIDTH>407 <HGT></HGT>408 <GROUPID>409 <GIDHIGHPART></GIDHIGHPART>410 <GIDLOWPART></GIDLOWPART>411 </GROUPID>412 </DOCKINFO>413 <SYMBOLICSWINSETTINGS EXECUTABLEPATH = "C:\Symbian\9.1\S60_3rd_MR_2\EPOC32\RELEASE\WINSCW\UDEB\euser.dll" MACHINENAME = "Local Windows PC"/>414 <SYMBOLICSWINSETTINGS EXECUTABLEPATH = "C:\Symbian\9.1\S60_3rd_MR_2\EPOC32\RELEASE\WINSCW\UDEB\ekern.exe" MACHINENAME = "Local Windows PC"/>415 <SYMBOLICSWINSETTINGS EXECUTABLEPATH = "C:\WINNT\system32\ntdll.dll" MACHINENAME = "Local Windows PC"/>416 <SYMBOLICSWINSETTINGS EXECUTABLEPATH = "C:\Symbian\9.1\S60_3rd_MR_2\EPOC32\RELEASE\WINSCW\UDEB\econs.dll" MACHINENAME = "Local Windows PC"/>417 </WINDOW>418 <WINDOW>419 <SESSION>-2147483648</SESSION>420 <EDOCTYPE>36</EDOCTYPE>421 <DEFAULT>true</DEFAULT>422 <FRAMELOC>423 <X>4</X>424 <Y>23</Y>425 </FRAMELOC>426 <FRAMESIZE>427 <W>390</W>428 <H>435</H>429 </FRAMESIZE>430 <DOCKINFO>431 <STATUS>0</STATUS>432 <ROW></ROW>433 <COLUMN></COLUMN>434 <DOCKBARID></DOCKBARID>435 <PCTWIDTH></PCTWIDTH>436 <HGT></HGT>437 <GROUPID>438 <GIDHIGHPART></GIDHIGHPART>439 <GIDLOWPART></GIDLOWPART>440 </GROUPID>441 </DOCKINFO>442 </WINDOW>443 <WINDOW>444 <SESSION>-2147483648</SESSION>445 <EDOCTYPE>20</EDOCTYPE>446 <DEFAULT>true</DEFAULT>447 <FRAMELOC>448 <X>4</X>449 <Y>23</Y>450 </FRAMELOC>451 <FRAMESIZE>452 <W>816</W>453 <H>1494</H>454 </FRAMESIZE>455 <DOCKINFO>456 <STATUS>0</STATUS>457 <ROW></ROW>458 <COLUMN></COLUMN>459 <DOCKBARID></DOCKBARID>460 <PCTWIDTH></PCTWIDTH>461 <HGT></HGT>462 <GROUPID>463 <GIDHIGHPART></GIDHIGHPART>464 <GIDLOWPART></GIDLOWPART>465 </GROUPID>466 </DOCKINFO>467 <SYMBOLICSWINSETTINGS EXECUTABLEPATH = "C:\Symbian\9.1\S60_3rd_MR_2\EPOC32\RELEASE\WINSCW\UDEB\euser.dll" MACHINENAME = "Local Windows PC"/>468 <SYMBOLICSWINSETTINGS EXECUTABLEPATH = "C:\Symbian\9.1\S60_3rd_MR_2\EPOC32\RELEASE\WINSCW\UDEB\ekern.exe" MACHINENAME = "Local Windows PC"/>469 <SYMBOLICSWINSETTINGS EXECUTABLEPATH = "C:\WINNT\system32\ntdll.dll" MACHINENAME = "Local Windows PC"/>470 <SYMBOLICSWINSETTINGS EXECUTABLEPATH = "C:\Symbian\9.1\S60_3rd_MR_2\EPOC32\RELEASE\WINSCW\UDEB\econs.dll" MACHINENAME = "Local Windows PC"/>471 </WINDOW>472 <WINDOW>473 <SESSION>-2147483648</SESSION>474 <EDOCTYPE>23</EDOCTYPE>475 <DEFAULT>true</DEFAULT>476 <FRAMELOC>477 <X>6</X>478 <Y>81</Y>479 </FRAMELOC>480 <FRAMESIZE>481 <W>566</W>482 <H>477</H>483 </FRAMESIZE>484 <DOCKINFO>485 <STATUS>0</STATUS>486 <ROW></ROW>487 <COLUMN></COLUMN>488 <DOCKBARID></DOCKBARID>489 <PCTWIDTH></PCTWIDTH>490 <HGT></HGT>491 <GROUPID>492 <GIDHIGHPART></GIDHIGHPART>493 <GIDLOWPART></GIDLOWPART>494 </GROUPID>495 </DOCKINFO>496 </WINDOW>497 365 </MWIDEWORKSPACE> -
pjproject/trunk/build.symbian/symbian_ua.mmp
r1242 r1246 25 25 SYSTEMINCLUDE \epoc32\include\libc 26 26 27 LIBRARY pjsua_lib.lib pjsip_ua.lib pjsip_simple.lib pjsip.lib pjsdp.lib pjmedia.lib pjnath.lib pjlib_util.lib pjlib.libesock.lib insock.lib charconv.lib euser.lib estlib.lib eexe.lib28 STATICLIBRARY ecrt0.lib27 LIBRARY esock.lib insock.lib charconv.lib euser.lib estlib.lib eexe.lib 28 STATICLIBRARY pjsua_lib.lib pjsip_ua.lib pjsip_simple.lib pjsip.lib pjsdp.lib pjmedia.lib pjnath.lib pjlib_util.lib pjlib.lib ecrt0.lib 29 29 CAPABILITY None 30 30 -
pjproject/trunk/pjlib/include/pj/config.h
r1244 r1246 36 36 #elif defined(__MWERKS__) 37 37 # include <pj/compat/cc_codew.h> 38 #elif defined(__GCCE__) 39 # include <pj/compat/cc_gcce.h> 40 #elif defined(__ARMCC__) 41 # include <pj/compat/cc_armcc.h> 38 42 #else 39 43 # error "Unknown compiler." -
pjproject/trunk/pjlib/include/pj/timer.h
r669 r1246 65 65 * The type for internal timer ID. 66 66 */ 67 #if defined(PJ_SYMBIAN) && PJ_SYMBIAN!=0 68 typedef void *pj_timer_id_t; 69 #else 67 70 typedef int pj_timer_id_t; 71 #endif 68 72 69 73 /** -
pjproject/trunk/pjlib/src/pj/guid_simple.c
r974 r1246 58 58 59 59 strcpy(str->ptr, str_pid); 60 sprintf(str->ptr+4, "%0 4x", clock_seq++);61 pj_memcpy(str->ptr+ 8, str_mac_addr, 12);60 sprintf(str->ptr+4, "%08x", clock_seq++); 61 pj_memcpy(str->ptr+12, str_mac_addr, 8); 62 62 str->slen = 20; 63 63 -
pjproject/trunk/pjlib/src/pj/ioqueue_symbian.cpp
r1244 r1246 35 35 { 36 36 int eventCount; 37 CPjTimeoutTimer *timeoutTimer;38 37 }; 39 38 … … 439 438 PJ_UNUSED_ARG(max_fd); 440 439 441 ioq = (pj_ioqueue_t*) pj_pool_zalloc(pool, sizeof(pj_ioqueue_t)); 442 ioq->timeoutTimer = CPjTimeoutTimer::NewL(); 440 ioq = PJ_POOL_ZALLOC_T(pool, pj_ioqueue_t); 443 441 *p_ioqueue = ioq; 444 442 return PJ_SUCCESS; … … 451 449 PJ_DEF(pj_status_t) pj_ioqueue_destroy( pj_ioqueue_t *ioq ) 452 450 { 453 delete ioq->timeoutTimer; 454 ioq->timeoutTimer = NULL; 455 451 PJ_UNUSED_ARG(ioq); 456 452 return PJ_SUCCESS; 457 453 } … … 488 484 pj_ioqueue_key_t *key; 489 485 490 key = (pj_ioqueue_key_t*) pj_pool_zalloc(pool, sizeof(pj_ioqueue_key_t));486 key = PJ_POOL_ZALLOC_T(pool, pj_ioqueue_key_t); 491 487 key->cbObj = CIoqueueCallback::NewL(ioq, key, sock, cb, user_data); 492 488 … … 553 549 pj_size_t size ) 554 550 { 555 pj_ memset(op_key, 0, size);551 pj_bzero(op_key, size); 556 552 } 557 553 … … 635 631 const pj_time_val *timeout) 636 632 { 637 CPjTimeoutTimer *timer; 638 639 if (timeout) { 640 //if (!ioq->timeoutTimer->IsActive()) 641 if (0) 642 timer = ioq->timeoutTimer; 643 else 644 timer = CPjTimeoutTimer::NewL(); 645 646 timer->StartTimer(timeout->sec*1000 + timeout->msec); 647 648 } else { 649 timer = NULL; 650 } 651 652 ioq->eventCount = 0; 653 654 do { 655 PjSymbianOS::Instance()->WaitForActiveObjects(); 656 } while (ioq->eventCount == 0 && (!timer || (timer && !timer->HasTimedOut()))); 657 658 if (timer && !timer->HasTimedOut()) 659 timer->Cancel(); 660 661 if (timer && timer != ioq->timeoutTimer) 662 delete timer; 663 664 return ioq->eventCount; 633 /* Polling is not necessary on Symbian, since all async activities 634 * are registered to active scheduler. 635 */ 636 PJ_UNUSED_ARG(ioq); 637 PJ_UNUSED_ARG(timeout); 638 return 0; 665 639 } 666 640 -
pjproject/trunk/pjlib/src/pj/os_core_symbian.cpp
r1245 r1246 84 84 85 85 CPjTimeoutTimer::CPjTimeoutTimer() 86 : CActive( EPriorityNormal), hasTimedOut_(PJ_FALSE)86 : CActive(PJ_SYMBIAN_TIMER_PRIORITY), hasTimedOut_(PJ_FALSE) 87 87 { 88 88 } … … 421 421 PJ_DEF(pj_status_t) pj_thread_sleep(unsigned msec) 422 422 { 423 //Not a good idea, as we don't want network events to424 //arrive while we're not polling them:425 //PjSymbianOS::Instance()->WaitForActiveObjects();426 427 //.. so rather use this, which won't wake up Active Objects:428 423 User::After(msec*1000); 429 430 424 return PJ_SUCCESS; 431 425 } -
pjproject/trunk/pjlib/src/pj/os_symbian.h
r1235 r1246 21 21 22 22 #include <pj/sock.h> 23 #include <pj/string.h> 23 24 24 25 #include <e32base.h> … … 34 35 class CPjSocketReader; 35 36 37 #ifndef PJ_SYMBIAN_TIMER_PRIORITY 38 # define PJ_SYMBIAN_TIMER_PRIORITY EPriorityNormal 39 #endif 40 36 41 // 37 42 // PJLIB Symbian's Socket … … 217 222 pj_sockaddr_in &pj_addr) 218 223 { 219 memset(&pj_addr, 0, sizeof(pj_sockaddr_in));224 pj_bzero(&pj_addr, sizeof(pj_sockaddr_in)); 220 225 pj_addr.sin_family = PJ_AF_INET; 221 pj_addr.sin_addr.s_addr = sym_addr.Address();222 pj_addr.sin_port = (pj_uint16_t) sym_addr.Port();226 pj_addr.sin_addr.s_addr = pj_htonl(sym_addr.Address()); 227 pj_addr.sin_port = pj_htons((pj_uint16_t) sym_addr.Port()); 223 228 } 224 229 … … 229 234 { 230 235 sym_addr.Init(KAfInet); 231 sym_addr.SetAddress((TUint32)pj_ addr.sin_addr.s_addr);232 sym_addr.SetPort(pj_ addr.sin_port);236 sym_addr.SetAddress((TUint32)pj_ntohl(pj_addr.sin_addr.s_addr)); 237 sym_addr.SetPort(pj_ntohs(pj_addr.sin_port)); 233 238 } 234 239 -
pjproject/trunk/pjlib/src/pj/sock_symbian.cpp
r1244 r1246 211 211 PJ_DEF(pj_uint16_t) pj_ntohs(pj_uint16_t netshort) 212 212 { 213 /* There's no difference in host/network byte order in Symbian */ 213 #if PJ_IS_LITTLE_ENDIAN 214 return pj_swap16(netshort); 215 #else 214 216 return netshort; 217 #endif 215 218 } 216 219 … … 220 223 PJ_DEF(pj_uint16_t) pj_htons(pj_uint16_t hostshort) 221 224 { 222 /* There's no difference in host/network byte order in Symbian */ 225 #if PJ_IS_LITTLE_ENDIAN 226 return pj_swap16(hostshort); 227 #else 223 228 return hostshort; 229 #endif 224 230 } 225 231 … … 229 235 PJ_DEF(pj_uint32_t) pj_ntohl(pj_uint32_t netlong) 230 236 { 231 /* There's no difference in host/network byte order in Symbian */ 237 #if PJ_IS_LITTLE_ENDIAN 238 return pj_swap32(netlong); 239 #else 232 240 return netlong; 241 #endif 233 242 } 234 243 … … 238 247 PJ_DEF(pj_uint32_t) pj_htonl(pj_uint32_t hostlong) 239 248 { 240 /* There's no difference in host/network byte order in Symbian */ 241 return hostlong; 249 #if PJ_IS_LITTLE_ENDIAN 250 return pj_swap32(hostlong); 251 #else 252 return netlong; 253 #endif 242 254 } 243 255 … … 251 263 static char str8[20]; 252 264 253 TInetAddr temp_addr((TUint32)inaddr.s_addr, (TUint)0); 265 /* (Symbian IP address is in host byte order) */ 266 TInetAddr temp_addr((TUint32)pj_ntohl(inaddr.s_addr), (TUint)0); 254 267 temp_addr.Output(str16); 255 268 … … 295 308 addr.Init(KAfInet); 296 309 if (addr.Input(ip_addr) == KErrNone) { 297 /* Success */298 inp->s_addr = addr.Address();310 /* Success (Symbian IP address is in host byte order) */ 311 inp->s_addr = pj_htonl(addr.Address()); 299 312 return 1; 300 313 } else { … … 498 511 PJ_CHECK_STACK(); 499 512 500 pj_ memset(&addr, 0, sizeof(addr));513 pj_bzero(&addr, sizeof(addr)); 501 514 addr.sin_family = PJ_AF_INET; 502 515 addr.sin_addr.s_addr = pj_htonl(addr32); -
pjproject/trunk/pjsip-apps/src/symbian_ua/ua.cpp
r1245 r1246 45 45 46 46 // 47 // Destination URI (to make call, or to subscribe presence) 48 // 49 #define SIP_DST_URI "sip:192.168.0.70:5061" 50 51 // 47 52 // Account 48 53 // … … 59 64 60 65 66 // 67 // Globals 68 // 69 static pjsua_acc_id g_acc_id = PJSUA_INVALID_ID; 70 static pjsua_call_id g_call_id = PJSUA_INVALID_ID; 71 static pjsua_buddy_id g_buddy_id = PJSUA_INVALID_ID; 61 72 62 73 … … 70 81 PJ_UNUSED_ARG(rdata); 71 82 83 if (g_call_id != PJSUA_INVALID_ID) { 84 pjsua_call_answer(call_id, PJSIP_SC_BUSY_HERE, NULL, NULL); 85 return; 86 } 87 72 88 pjsua_call_get_info(call_id, &ci); 73 89 … … 76 92 ci.remote_info.ptr)); 77 93 94 g_call_id = call_id; 95 78 96 /* Automatically answer incoming calls with 200/OK */ 79 97 pjsua_call_answer(call_id, 200, NULL, NULL); … … 88 106 89 107 pjsua_call_get_info(call_id, &ci); 108 109 if (ci.state == PJSIP_INV_STATE_DISCONNECTED) { 110 if (call_id == g_call_id) 111 g_call_id = PJSUA_INVALID_ID; 112 } else { 113 if (g_call_id == PJSUA_INVALID_ID) 114 g_call_id = call_id; 115 } 116 90 117 PJ_LOG(3,(THIS_FILE, "Call %d state=%.*s", call_id, 91 118 (int)ci.state_text.slen, … … 108 135 109 136 137 /* Handler on buddy state changed. */ 138 static void on_buddy_state(pjsua_buddy_id buddy_id) 139 { 140 pjsua_buddy_info info; 141 pjsua_buddy_get_info(buddy_id, &info); 142 143 PJ_LOG(3,(THIS_FILE, "%.*s status is %.*s", 144 (int)info.uri.slen, 145 info.uri.ptr, 146 (int)info.status_text.slen, 147 info.status_text.ptr)); 148 } 149 150 151 /* Incoming IM message (i.e. MESSAGE request)! */ 152 static void on_pager(pjsua_call_id call_id, const pj_str_t *from, 153 const pj_str_t *to, const pj_str_t *contact, 154 const pj_str_t *mime_type, const pj_str_t *text) 155 { 156 /* Note: call index may be -1 */ 157 PJ_UNUSED_ARG(call_id); 158 PJ_UNUSED_ARG(to); 159 PJ_UNUSED_ARG(contact); 160 PJ_UNUSED_ARG(mime_type); 161 162 PJ_LOG(3,(THIS_FILE,"MESSAGE from %.*s: %.*s", 163 (int)from->slen, from->ptr, 164 (int)text->slen, text->ptr)); 165 } 166 167 168 /* Received typing indication */ 169 static void on_typing(pjsua_call_id call_id, const pj_str_t *from, 170 const pj_str_t *to, const pj_str_t *contact, 171 pj_bool_t is_typing) 172 { 173 PJ_UNUSED_ARG(call_id); 174 PJ_UNUSED_ARG(to); 175 PJ_UNUSED_ARG(contact); 176 177 PJ_LOG(3,(THIS_FILE, "IM indication: %.*s %s", 178 (int)from->slen, from->ptr, 179 (is_typing?"is typing..":"has stopped typing"))); 180 } 181 182 183 /* Call transfer request status. */ 184 static void on_call_transfer_status(pjsua_call_id call_id, 185 int status_code, 186 const pj_str_t *status_text, 187 pj_bool_t final, 188 pj_bool_t *p_cont) 189 { 190 PJ_LOG(3,(THIS_FILE, "Call %d: transfer status=%d (%.*s) %s", 191 call_id, status_code, 192 (int)status_text->slen, status_text->ptr, 193 (final ? "[final]" : ""))); 194 195 if (status_code/100 == 2) { 196 PJ_LOG(3,(THIS_FILE, 197 "Call %d: call transfered successfully, disconnecting call", 198 call_id)); 199 pjsua_call_hangup(call_id, PJSIP_SC_GONE, NULL, NULL); 200 *p_cont = PJ_FALSE; 201 } 202 } 203 204 205 /* Notification that call is being replaced. */ 206 static void on_call_replaced(pjsua_call_id old_call_id, 207 pjsua_call_id new_call_id) 208 { 209 pjsua_call_info old_ci, new_ci; 210 211 pjsua_call_get_info(old_call_id, &old_ci); 212 pjsua_call_get_info(new_call_id, &new_ci); 213 214 PJ_LOG(3,(THIS_FILE, "Call %d with %.*s is being replaced by " 215 "call %d with %.*s", 216 old_call_id, 217 (int)old_ci.remote_info.slen, old_ci.remote_info.ptr, 218 new_call_id, 219 (int)new_ci.remote_info.slen, new_ci.remote_info.ptr)); 220 } 221 222 110 223 /* Logging callback */ 111 224 static void log_writer(int level, const char *buf, unsigned len) … … 126 239 * url may contain URL to call. 127 240 */ 128 static pj_status_t app_startup(char *url) 129 { 130 pjsua_acc_id acc_id = 0; 241 static pj_status_t app_startup() 242 { 131 243 pj_status_t status; 132 244 … … 139 251 pjsua_perror(THIS_FILE, "pjsua_create() error", status); 140 252 return status; 141 }142 143 /* If argument is specified, it's got to be a valid SIP URL */144 if (url) {145 status = pjsua_verify_sip_url(url);146 if (status != PJ_SUCCESS) {147 pjsua_perror(THIS_FILE, "Invalid URL", status);148 return status;149 }150 253 } 151 254 … … 162 265 cfg.cb.on_call_media_state = &on_call_media_state; 163 266 cfg.cb.on_call_state = &on_call_state; 267 cfg.cb.on_buddy_state = &on_buddy_state; 268 cfg.cb.on_pager = &on_pager; 269 cfg.cb.on_typing = &on_typing; 270 cfg.cb.on_call_transfer_status = &on_call_transfer_status; 271 cfg.cb.on_call_replaced = &on_call_replaced; 164 272 165 273 if (SIP_PROXY) { … … 200 308 } 201 309 202 pjsua_acc_add_local(tid, PJ_TRUE, & acc_id);310 pjsua_acc_add_local(tid, PJ_TRUE, &g_acc_id); 203 311 } 204 312 … … 225 333 cfg.cred_info[0].data = pj_str(SIP_PASSWD); 226 334 227 status = pjsua_acc_add(&cfg, PJ_TRUE, & acc_id);335 status = pjsua_acc_add(&cfg, PJ_TRUE, &g_acc_id); 228 336 if (status != PJ_SUCCESS) { 229 337 pjsua_perror(THIS_FILE, "Error adding account", status); … … 233 341 } 234 342 235 /* If URL is specified, make call to the URL. */ 236 if (url != NULL) { 237 pj_str_t uri = pj_str(url); 238 status = pjsua_call_make_call(acc_id, &uri, 0, NULL, NULL, NULL); 239 if (status != PJ_SUCCESS) { 240 pjsua_perror(THIS_FILE, "Error making call", status); 241 pjsua_destroy(); 242 return status; 243 } 244 245 } 246 343 if (SIP_DST_URI) { 344 pjsua_buddy_config bcfg; 345 346 pjsua_buddy_config_default(&bcfg); 347 bcfg.uri = pj_str(SIP_DST_URI); 348 bcfg.subscribe = PJ_FALSE; 349 350 pjsua_buddy_add(&bcfg, &g_buddy_id); 351 } 247 352 return PJ_SUCCESS; 248 353 } … … 308 413 " D Dump all states (detail)\n" 309 414 " P Dump pool factory\n" 415 " m Make call\n" 416 " a Answer call\n" 310 417 " h Hangup all calls\n" 418 " s Subscribe to buddy presence\n" 419 " S Unsubscribe buddy presence\n" 420 " o Set account online\n" 421 " O Set account offline\n" 311 422 " q Quit\n")); 312 423 } … … 316 427 { 317 428 TKeyCode kc = con_->KeyCode(); 318 429 pj_bool_t reschedule = PJ_TRUE; 430 319 431 switch (kc) { 320 432 case 'q': 321 433 asw_->AsyncStop(); 434 reschedule = PJ_FALSE; 322 435 break; 323 436 case 'D': 324 437 case 'd': 325 438 pjsua_dump(kc == 'D'); 326 Run();327 439 break; 328 440 case 'P': 329 441 pj_pool_factory_dump(&pjsua_var.cp.factory, PJ_TRUE); 330 442 break; 443 case 'm': 444 if (g_call_id != PJSUA_INVALID_ID) { 445 PJ_LOG(3,(THIS_FILE, "Another call is active")); 446 break; 447 } 448 449 if (pjsua_verify_sip_url(SIP_DST_URI) == PJ_SUCCESS) { 450 pj_str_t dst = pj_str(SIP_DST_URI); 451 pjsua_call_make_call(g_acc_id, &dst, 0, NULL, 452 NULL, &g_call_id); 453 } else { 454 PJ_LOG(3,(THIS_FILE, "Invalid SIP URI")); 455 } 456 break; 457 case 'a': 458 if (g_call_id != PJSUA_INVALID_ID) 459 pjsua_call_answer(g_call_id, 200, NULL, NULL); 460 break; 331 461 case 'h': 332 462 pjsua_call_hangup_all(); 333 Run(); 463 break; 464 case 's': 465 case 'S': 466 if (g_buddy_id != PJSUA_INVALID_ID) 467 pjsua_buddy_subscribe_pres(g_buddy_id, kc=='s'); 468 break; 469 case 'o': 470 case 'O': 471 pjsua_acc_set_online_status(g_acc_id, kc=='o'); 334 472 break; 335 473 default: 336 474 PJ_LOG(3,(THIS_FILE, "Keycode '%c' (%d) is pressed", 337 475 kc, kc)); 476 break; 477 } 478 479 PrintMenu(); 480 481 if (reschedule) 338 482 Run(); 339 break;340 }341 342 PrintMenu();343 483 } 344 484 … … 349 489 350 490 // Initialize pjsua 351 status = app_startup( "sip:192.168.0.77");491 status = app_startup(); 352 492 if (status != PJ_SUCCESS) 353 493 return status; -
pjproject/trunk/pjsip/src/pjsip/sip_transaction.c
r1241 r1246 142 142 (64*PJSIP_T1_TIMEOUT)%1000 }; 143 143 144 /* Internal timer IDs */ 145 enum Transaction_Timer_Id 146 { 147 TSX_TIMER_RETRANSMISSION, 148 TSX_TIMER_TIMEOUT, 149 }; 144 #define TIMER_INACTIVE 0 145 #define TIMER_ACTIVE 1 150 146 151 147 … … 911 907 912 908 tsx->handle_200resp = 1; 913 tsx->retransmit_timer.id = TSX_TIMER_RETRANSMISSION; 914 tsx->retransmit_timer._timer_id = -1; 909 tsx->retransmit_timer.id = 0; 915 910 tsx->retransmit_timer.user_data = tsx; 916 911 tsx->retransmit_timer.cb = &tsx_timer_callback; 917 tsx->timeout_timer.id = TSX_TIMER_TIMEOUT; 918 tsx->timeout_timer._timer_id = -1; 912 tsx->timeout_timer.id = 0; 919 913 tsx->timeout_timer.user_data = tsx; 920 914 tsx->timeout_timer.cb = &tsx_timer_callback; … … 950 944 } 951 945 /* Cancel timeout timer. */ 952 if (tsx->timeout_timer. _timer_id != -1) {946 if (tsx->timeout_timer.id != 0) { 953 947 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->timeout_timer); 954 tsx->timeout_timer. _timer_id = -1;948 tsx->timeout_timer.id = 0; 955 949 } 956 950 /* Cancel retransmission timer. */ 957 if (tsx->retransmit_timer. _timer_id != -1) {951 if (tsx->retransmit_timer.id != 0) { 958 952 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->retransmit_timer); 959 tsx->retransmit_timer. _timer_id = -1;953 tsx->retransmit_timer.id = 0; 960 954 } 961 955 … … 1002 996 PJ_UNUSED_ARG(theap); 1003 997 998 entry->id = 0; 999 1004 1000 PJ_LOG(5,(tsx->obj_name, "%s timer event", 1005 (entry->id==TSX_TIMER_RETRANSMISSION ? "Retransmit":"Timeout"))); 1006 1007 1008 if (entry->id == TSX_TIMER_RETRANSMISSION) { 1009 PJSIP_EVENT_INIT_TIMER(event, &tsx->retransmit_timer); 1010 } else { 1011 PJSIP_EVENT_INIT_TIMER(event, &tsx->timeout_timer); 1012 } 1001 (entry==&tsx->retransmit_timer ? "Retransmit":"Timeout"))); 1002 1003 1004 PJSIP_EVENT_INIT_TIMER(event, entry); 1013 1005 1014 1006 /* Dispatch event to transaction. */ … … 1082 1074 } else { 1083 1075 /* Cancel timeout timer. */ 1084 if (tsx->timeout_timer. _timer_id != -1) {1076 if (tsx->timeout_timer.id != 0) { 1085 1077 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->timeout_timer); 1086 tsx->timeout_timer. _timer_id = -1;1078 tsx->timeout_timer.id = 0; 1087 1079 } 1088 1080 1081 tsx->timeout_timer.id = TIMER_ACTIVE; 1089 1082 pjsip_endpt_schedule_timer( tsx->endpt, &tsx->timeout_timer, 1090 1083 &timeout); … … 1822 1815 timeout.sec = msec_time / 1000; 1823 1816 timeout.msec = msec_time % 1000; 1817 tsx->retransmit_timer.id = TIMER_ACTIVE; 1824 1818 pjsip_endpt_schedule_timer( tsx->endpt, &tsx->retransmit_timer, 1825 1819 &timeout); … … 1913 1907 * timeout. 1914 1908 */ 1909 tsx->timeout_timer.id = TIMER_ACTIVE; 1915 1910 pjsip_endpt_schedule_timer( tsx->endpt, &tsx->timeout_timer, 1916 1911 &timeout_timer_val); … … 1924 1919 tsx->transport_flag |= TSX_HAS_PENDING_RESCHED; 1925 1920 } else { 1921 tsx->retransmit_timer.id = TIMER_ACTIVE; 1926 1922 pjsip_endpt_schedule_timer(tsx->endpt, &tsx->retransmit_timer, 1927 1923 &t1_timer_val); … … 1964 1960 1965 1961 /* Cancel retransmission timer. */ 1966 if (tsx->retransmit_timer. _timer_id != -1) {1962 if (tsx->retransmit_timer.id != 0) { 1967 1963 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->retransmit_timer); 1968 tsx->retransmit_timer. _timer_id = -1;1964 tsx->retransmit_timer.id = 0; 1969 1965 } 1970 1966 tsx->transport_flag &= ~(TSX_HAS_PENDING_RESCHED); … … 1997 1993 */ 1998 1994 if (code >= 200) { 1999 if (tsx->retransmit_timer. _timer_id != -1) {1995 if (tsx->retransmit_timer.id != 0) { 2000 1996 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->retransmit_timer); 2001 tsx->retransmit_timer. _timer_id = -1;1997 tsx->retransmit_timer.id = 0; 2002 1998 } 2003 1999 2004 if (tsx->timeout_timer. _timer_id != -1) {2000 if (tsx->timeout_timer.id != 0) { 2005 2001 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->timeout_timer); 2006 tsx->timeout_timer. _timer_id = -1;2002 tsx->timeout_timer.id = 0; 2007 2003 } 2008 2004 … … 2011 2007 * retransmit timer will be rescheduled at T2. 2012 2008 */ 2013 if (tsx->retransmit_timer. _timer_id != -1) {2009 if (tsx->retransmit_timer.id != 0) { 2014 2010 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->retransmit_timer); 2015 tsx->retransmit_timer. _timer_id = -1;2011 tsx->retransmit_timer.id = 0; 2016 2012 } 2017 2013 … … 2029 2025 } else { 2030 2026 if (!tsx->is_reliable) { 2027 tsx->retransmit_timer.id = TIMER_ACTIVE; 2031 2028 pjsip_endpt_schedule_timer(tsx->endpt, 2032 2029 &tsx->retransmit_timer, … … 2202 2199 tsx->transport_flag |= TSX_HAS_PENDING_RESCHED; 2203 2200 } else { 2201 tsx->retransmit_timer.id = TIMER_ACTIVE; 2204 2202 pjsip_endpt_schedule_timer( tsx->endpt, 2205 2203 &tsx->retransmit_timer, … … 2240 2238 } 2241 2239 2240 tsx->timeout_timer.id = TIMER_ACTIVE; 2242 2241 pjsip_endpt_schedule_timer( tsx->endpt, &tsx->timeout_timer, 2243 2242 &timeout); … … 2265 2264 if (tsx->method.id == PJSIP_INVITE_METHOD) { 2266 2265 /* Start timer H for INVITE */ 2266 tsx->timeout_timer.id = TIMER_ACTIVE; 2267 2267 pjsip_endpt_schedule_timer(tsx->endpt,&tsx->timeout_timer, 2268 2268 &timeout_timer_val); 2269 2269 } else if (!tsx->is_reliable) { 2270 2270 /* Start timer J on 64*T1 seconds for non-INVITE */ 2271 tsx->timeout_timer.id = TIMER_ACTIVE; 2271 2272 pjsip_endpt_schedule_timer(tsx->endpt,&tsx->timeout_timer, 2272 2273 &timeout_timer_val); … … 2274 2275 /* Start timer J on zero seconds for non-INVITE */ 2275 2276 pj_time_val zero_time = { 0, 0 }; 2277 tsx->timeout_timer.id = TIMER_ACTIVE; 2276 2278 pjsip_endpt_schedule_timer(tsx->endpt,&tsx->timeout_timer, 2277 2279 &zero_time); … … 2290 2292 tsx->transport_flag |= TSX_HAS_PENDING_RESCHED; 2291 2293 } else { 2294 tsx->retransmit_timer.id = TIMER_ACTIVE; 2292 2295 pjsip_endpt_schedule_timer(tsx->endpt, 2293 2296 &tsx->retransmit_timer, … … 2427 2430 timeout.sec = timeout.msec = 0; 2428 2431 } 2432 tsx->timeout_timer.id = TIMER_ACTIVE; 2429 2433 pjsip_endpt_schedule_timer( tsx->endpt, &tsx->timeout_timer, 2430 2434 &timeout); 2431 2435 2432 2436 /* Cancel retransmission timer */ 2433 if (tsx->retransmit_timer. _timer_id != -1) {2437 if (tsx->retransmit_timer.id != 0) { 2434 2438 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->retransmit_timer); 2435 tsx->retransmit_timer. _timer_id = -1;2439 tsx->retransmit_timer.id = 0; 2436 2440 } 2437 2441 … … 2494 2498 timeout.sec = timeout.msec = 0; 2495 2499 } 2500 tsx->timeout->timer.id = TSX_TIMER_TIMEOUT; 2496 2501 pjsip_endpt_schedule_timer( tsx->endpt, &tsx->timeout_timer, &timeout); 2497 2502 … … 2562 2567 timeout.sec = timeout.msec = 0; 2563 2568 } 2569 tsx->timeout_timer.id = TIMER_ACTIVE; 2564 2570 pjsip_endpt_schedule_timer( tsx->endpt, &tsx->timeout_timer, &timeout); 2565 2571 … … 2602 2608 2603 2609 /* Cease retransmission. */ 2604 if (tsx->retransmit_timer. _timer_id != -1) {2610 if (tsx->retransmit_timer.id != 0) { 2605 2611 pjsip_endpt_cancel_timer(tsx->endpt, &tsx->retransmit_timer); 2606 tsx->retransmit_timer. _timer_id = -1;2612 tsx->retransmit_timer.id = 0; 2607 2613 } 2608 2614 tsx->transport_flag &= ~(TSX_HAS_PENDING_RESCHED); … … 2610 2616 /* Start timer I in T4 interval (transaction termination). */ 2611 2617 pjsip_endpt_cancel_timer( tsx->endpt, &tsx->timeout_timer ); 2618 tsx->timeout_timer.id = TIMER_ACTIVE; 2612 2619 pjsip_endpt_schedule_timer( tsx->endpt, &tsx->timeout_timer, 2613 2620 &t4_timer_val); -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c
r1224 r1246 646 646 static void busy_sleep(unsigned msec) 647 647 { 648 #if defined(PJ_SYMBIAN) && PJ_SYMBIAN != 0 649 pj_thread_sleep(msec); 650 #else 648 651 pj_time_val timeout, now; 649 652 … … 657 660 pj_gettimeofday(&now); 658 661 } while (PJ_TIME_VAL_LT(now, timeout)); 662 #endif 659 663 } 660 664
Note: See TracChangeset
for help on using the changeset viewer.