| 49 |
#include "m3gdevice.h" |
#include "m3gdevice.h" |
| 50 |
#include "gcisdndevice.h" |
#include "gcisdndevice.h" |
| 51 |
#include "gciptboard.h" |
#include "gciptboard.h" |
| 52 |
|
#include "gciptdevice.h" |
| 53 |
#include "confdevice.h" |
#include "confdevice.h" |
| 54 |
#include "confpartydevice.h" |
#include "confpartydevice.h" |
| 55 |
|
#include "mediastatemachine.h" |
| 56 |
|
|
| 57 |
/*----------------------------------------------------------------------------*/ |
/*----------------------------------------------------------------------------*/ |
| 58 |
|
|
| 59 |
/*! |
/*! |
| 60 |
|
* \struct Player - data for playing media. |
| 61 |
|
*/ |
| 62 |
|
struct Player |
| 63 |
|
{ |
| 64 |
|
/* request |
| 65 |
|
*/ |
| 66 |
|
std::string audioFile; |
| 67 |
|
std::string audioEncoding; |
| 68 |
|
std::string videoFile; |
| 69 |
|
std::string videoEncoding; |
| 70 |
|
unsigned int videoSize; |
| 71 |
|
int repeatCount; |
| 72 |
|
|
| 73 |
|
/* response |
| 74 |
|
*/ |
| 75 |
|
std::string reason; |
| 76 |
|
unsigned int duration; |
| 77 |
|
}; |
| 78 |
|
|
| 79 |
|
/*! |
| 80 |
|
* \struct Recorder - data for recording media. |
| 81 |
|
*/ |
| 82 |
|
struct Recorder |
| 83 |
|
{ |
| 84 |
|
/* request |
| 85 |
|
*/ |
| 86 |
|
std::string audioFile; |
| 87 |
|
std::string audioEncoding; |
| 88 |
|
std::string videoFile; |
| 89 |
|
std::string videoEncoding; |
| 90 |
|
unsigned int videoSize; |
| 91 |
|
bool beep; |
| 92 |
|
|
| 93 |
|
/* response |
| 94 |
|
*/ |
| 95 |
|
std::string reason; |
| 96 |
|
unsigned int duration; |
| 97 |
|
}; |
| 98 |
|
|
| 99 |
|
/*! |
| 100 |
* \class DialogicChannel |
* \class DialogicChannel |
| 101 |
* A channel manages the resources for a single call leg. |
* A channel manages the resources for a single call leg. |
| 102 |
*/ |
*/ |
| 109 |
*/ |
*/ |
| 110 |
DialogicChannel( DialogicChannelManager& channelMgr, |
DialogicChannel( DialogicChannelManager& channelMgr, |
| 111 |
GcIsdnDevice* gc, |
GcIsdnDevice* gc, |
| 112 |
IpmDevice* ipm ) |
IpmDevice* ipm ); |
|
: channelMgr_ (channelMgr), |
|
|
gcDevice_ (gc), |
|
|
ipmDevice_ (ipm), |
|
|
mmDevice_ (0), |
|
|
protocol_ (gc->getProtocol()) /* ISDN | SS7 */ |
|
|
{;} |
|
| 113 |
|
|
| 114 |
/*! |
/*! |
| 115 |
* ctor. SIP |
* ctor. SIP |
| 116 |
*/ |
*/ |
| 117 |
DialogicChannel( DialogicChannelManager& channelMgr, |
DialogicChannel( DialogicChannelManager& channelMgr, |
| 118 |
|
StateMachine& sm, |
| 119 |
GcIptDevice* gc, |
GcIptDevice* gc, |
| 120 |
IpmDevice* ipm ) |
IpmDevice* ipm ); |
|
: channelMgr_ (channelMgr), |
|
|
gcDevice_ (gc), |
|
|
ipmDevice_ (ipm), |
|
|
mmDevice_ (0), |
|
|
protocol_ (PROTOCOL_SIP) |
|
|
{;} |
|
| 121 |
|
|
| 122 |
/*! |
/*! |
| 123 |
* ctor. CONF |
* ctor. CONF |
| 124 |
*/ |
*/ |
| 125 |
DialogicChannel( DialogicChannelManager& channelMgr, |
DialogicChannel( DialogicChannelManager& channelMgr, |
| 126 |
|
StateMachine& sm, |
| 127 |
ConfDevice* confDevice, |
ConfDevice* confDevice, |
| 128 |
ConfPartyDevice* confParty, |
ConfPartyDevice* confParty, |
| 129 |
IpmDevice* ipm ) |
IpmDevice* ipm ); |
| 130 |
: channelMgr_ (channelMgr), |
|
| 131 |
gcDevice_ (0), |
/*! |
| 132 |
ipmDevice_ (ipm), |
* dtor |
| 133 |
mmDevice_ (0), |
*/ |
| 134 |
confDevice_ (confDevice), |
virtual ~DialogicChannel(); |
| 135 |
confParty_ (confParty), |
|
| 136 |
protocol_ (PROTOCOL_CONF) |
/*! |
| 137 |
{;} |
* Get the channel manager object. |
| 138 |
|
*/ |
| 139 |
|
DialogicChannelManager& getChannelMgr() const { return channelMgr_; } |
| 140 |
|
|
| 141 |
/*! |
/*! |
| 142 |
* Get the signalling protocol. |
* Get the signalling protocol. |
| 316 |
virtual void getRemoteRtpVideoInfo( IpInfo& rtp_video ) const; |
virtual void getRemoteRtpVideoInfo( IpInfo& rtp_video ) const; |
| 317 |
|
|
| 318 |
/*! |
/*! |
| 319 |
|
* Get the player object. |
| 320 |
|
*/ |
| 321 |
|
const Player& getPlayer() const { return player_; } |
| 322 |
|
|
| 323 |
|
/*! |
| 324 |
|
* Get the recoder object. |
| 325 |
|
*/ |
| 326 |
|
const Recorder& getRecorder() const { return recorder_; } |
| 327 |
|
|
| 328 |
|
/*! |
| 329 |
* Clear the digit collection buffer. |
* Clear the digit collection buffer. |
| 330 |
*/ |
*/ |
| 331 |
void clearDigits() { collected_digits_.clear(); } |
void clearDigits() { collected_digits_.clear(); } |
| 341 |
*/ |
*/ |
| 342 |
const std::string& getDigits() const { return collected_digits_; } |
const std::string& getDigits() const { return collected_digits_; } |
| 343 |
|
|
| 344 |
|
/*! |
| 345 |
|
* Pass an event to the media state machine. |
| 346 |
|
*/ |
| 347 |
|
void onMediaEvent( Event* event ); |
| 348 |
|
|
| 349 |
|
/*! |
| 350 |
|
* Handle an incoming call event from a dti device. |
| 351 |
|
* \param gc - source of the event. |
| 352 |
|
* \param local_number - called number. |
| 353 |
|
* \param remote_number - calling number. |
| 354 |
|
*/ |
| 355 |
|
void onIncoming( GcIsdnDevice* gc, |
| 356 |
|
const std::string& local_number, |
| 357 |
|
const std::string& remote_number ); |
| 358 |
|
/*! |
| 359 |
|
* Handle an incoming call event from a ipt device. |
| 360 |
|
* \param gc - source of the event. |
| 361 |
|
* \param local_number - called number. |
| 362 |
|
* \param remote_number - calling number. |
| 363 |
|
*/ |
| 364 |
|
void onIncoming( GcIptDevice* gc, |
| 365 |
|
const std::string& local_number, |
| 366 |
|
const std::string& remote_number ); |
| 367 |
|
|
| 368 |
|
/*! |
| 369 |
|
* Handle a call accepted event from a dti/ipt device. |
| 370 |
|
* \param gc - source of the event. |
| 371 |
|
*/ |
| 372 |
|
void onAccepted( GcDevice* gc ); |
| 373 |
|
|
| 374 |
|
/*! |
| 375 |
|
* Handle a call accepted event from a dti/ipt device. |
| 376 |
|
* \param gc - source of the event. |
| 377 |
|
*/ |
| 378 |
|
void onAnswered( GcDevice* gc ); |
| 379 |
|
|
| 380 |
|
/*! |
| 381 |
|
* Handle a call proceeding event from a dti/ipt device. |
| 382 |
|
* \param gc - source of the event. |
| 383 |
|
*/ |
| 384 |
|
void onProceeding( GcDevice* gc ); |
| 385 |
|
|
| 386 |
|
/*! |
| 387 |
|
* Handle a call proceeding event from a conf party device. |
| 388 |
|
* \param party - source of the event. |
| 389 |
|
*/ |
| 390 |
|
void onProceeding( ConfPartyDevice* party ); |
| 391 |
|
|
| 392 |
|
/*! |
| 393 |
|
* Handle a remote party ringing event from a dti/ipt device. |
| 394 |
|
* \param gc - source of the event. |
| 395 |
|
*/ |
| 396 |
|
void onRinging( GcDevice* gc ); |
| 397 |
|
|
| 398 |
|
/*! |
| 399 |
|
* Handle a hangup from a dti/ipt device. |
| 400 |
|
* \param gc - source of the event. |
| 401 |
|
* \param cause - Q.931 cause value |
| 402 |
|
* \param cause_text - description |
| 403 |
|
* \param conn_type - cpa result (if applicable) |
| 404 |
|
*/ |
| 405 |
|
void onHangup( GcDevice* gc, |
| 406 |
|
int cause, |
| 407 |
|
const std::string& cause_text, |
| 408 |
|
const std::string& conn_type = std::string()); |
| 409 |
|
|
| 410 |
|
/*! |
| 411 |
|
* Handle a hangup from a conference device. Called for all parties when the |
| 412 |
|
* controller hangs up. |
| 413 |
|
* \param confParty - source of the event. |
| 414 |
|
*/ |
| 415 |
|
void onHangup( ConfPartyDevice* confParty ); |
| 416 |
|
|
| 417 |
|
/*! |
| 418 |
|
* Handle a call connected event from a dti/ipt device. |
| 419 |
|
* \param gc - source of the event. |
| 420 |
|
* \param conn_type - cpa result. |
| 421 |
|
*/ |
| 422 |
|
void onConnect( GcDevice* gc, const std::string& conn_type ); |
| 423 |
|
|
| 424 |
|
/*! |
| 425 |
|
* Handle a call connected event from a conference device. |
| 426 |
|
* \param party - source of the event. |
| 427 |
|
*/ |
| 428 |
|
void onConnect( ConfPartyDevice* party ); |
| 429 |
|
|
| 430 |
|
/*! |
| 431 |
|
* Handle a dtmf digit received event. |
| 432 |
|
* \param gc - 'apparent' source of the event. |
| 433 |
|
* \param dtmf - ascii coded dtmf digit. |
| 434 |
|
*/ |
| 435 |
|
void onDtmf( GcDevice* gc, char dtmf ); |
| 436 |
|
|
| 437 |
|
/*! |
| 438 |
|
* Handle a tone detection event. |
| 439 |
|
* \param gc - 'apparent' source of the event. |
| 440 |
|
* \param name - the tone that has been detected. |
| 441 |
|
*/ |
| 442 |
|
void onTone( GcDevice* gc, const std::string& name ); |
| 443 |
|
|
| 444 |
|
/*! |
| 445 |
|
* Handle a dtmf send completion event. |
| 446 |
|
* This interface is used for digits sent as in-band tones. |
| 447 |
|
* \param gc - source of the event. |
| 448 |
|
*/ |
| 449 |
|
void onSendDtmfCompleted( GcDevice* gc ); |
| 450 |
|
|
| 451 |
|
/*! |
| 452 |
|
* Handle a media connect completion event from a device. |
| 453 |
|
* \param device - source of the event. |
| 454 |
|
*/ |
| 455 |
|
void onConnectCompleted( IpmDevice* device ); |
| 456 |
|
|
| 457 |
|
/*! |
| 458 |
|
* Handle a media disconnect completion event from a device. |
| 459 |
|
* \param device - source of the event. |
| 460 |
|
*/ |
| 461 |
|
void onDisconnectCompleted( IpmDevice* device ); |
| 462 |
|
|
| 463 |
|
/*! |
| 464 |
|
* Handle a media connect completion event from a device. |
| 465 |
|
* \param device - source of the event. |
| 466 |
|
*/ |
| 467 |
|
void onConnectCompleted( MmDevice* device ); |
| 468 |
|
|
| 469 |
|
/*! |
| 470 |
|
* Handle a media disconnect completion event from a device. |
| 471 |
|
* \param device - source of the event. |
| 472 |
|
*/ |
| 473 |
|
void onDisconnectCompleted( MmDevice* device ); |
| 474 |
|
|
| 475 |
|
/*! |
| 476 |
|
* Handle a media connect completion event from a device. |
| 477 |
|
* \param device - source of the event. |
| 478 |
|
*/ |
| 479 |
|
void onConnectCompleted( ConfPartyDevice* device ); |
| 480 |
|
|
| 481 |
|
/*! |
| 482 |
|
* Handle a media disconnect completion event from a device. |
| 483 |
|
* \param device - source of the event. |
| 484 |
|
*/ |
| 485 |
|
void onDisconnectCompleted( ConfPartyDevice* device ); |
| 486 |
|
|
| 487 |
|
/*! |
| 488 |
|
* Handle a play completion event from an mm device. |
| 489 |
|
* \param mm - source of the event. |
| 490 |
|
* \param reason - why the play stopped. |
| 491 |
|
* \param duration - length of play in ms. |
| 492 |
|
*/ |
| 493 |
|
void onPlayCompleted( MmDevice* mm, |
| 494 |
|
const std::string& reason, |
| 495 |
|
unsigned int duration ); |
| 496 |
|
|
| 497 |
|
/*! |
| 498 |
|
* Handle a play completion event from the state machine. |
| 499 |
|
*/ |
| 500 |
|
void onPlayCompleted(); |
| 501 |
|
|
| 502 |
|
/*! |
| 503 |
|
* Handle a record completion event from an mm device. |
| 504 |
|
* \param mm - source of the event. |
| 505 |
|
* \param reason - why the recording stopped. |
| 506 |
|
* \param duration - length of recording in ms. |
| 507 |
|
*/ |
| 508 |
|
void onRecordCompleted( MmDevice* mm, |
| 509 |
|
const std::string& reason, |
| 510 |
|
unsigned int duration ); |
| 511 |
|
|
| 512 |
|
/*! |
| 513 |
|
* Handle a record completion event from the state machine. |
| 514 |
|
*/ |
| 515 |
|
void onRecordCompleted(); |
| 516 |
|
|
| 517 |
private: |
private: |
| 518 |
|
|
| 519 |
DialogicChannel(); |
DialogicChannel(); |
| 524 |
|
|
| 525 |
DialogicChannelManager& channelMgr_; |
DialogicChannelManager& channelMgr_; |
| 526 |
|
|
| 527 |
|
Context* context_; /* media state machine */ |
| 528 |
|
|
| 529 |
GcDevice* gcDevice_; /* dti(dk) or ipt */ |
GcDevice* gcDevice_; /* dti(dk) or ipt */ |
| 530 |
IpmDevice* ipmDevice_; |
IpmDevice* ipmDevice_; |
| 531 |
MmDevice* mmDevice_; |
MmDevice* mmDevice_; |
|
M3gDevice* m3gDevice_; |
|
| 532 |
ConfDevice* confDevice_; |
ConfDevice* confDevice_; |
| 533 |
ConfPartyDevice* confParty_; |
ConfPartyDevice* confParty_; |
| 534 |
|
|
| 535 |
|
M3gDevice* m3gDevice_; /* FUTURE */ |
| 536 |
|
|
| 537 |
Protocol protocol_; |
Protocol protocol_; |
| 538 |
|
|
| 539 |
std::string stop_digits_; /* play/record remination digits */ |
std::string stop_digits_; /* play/record remination digits */ |
| 540 |
std::string collected_digits_; /* digits received during a play */ |
std::string collected_digits_; /* digits received during a play */ |
| 541 |
|
|
| 542 |
|
Player player_; |
| 543 |
|
Recorder recorder_; |
| 544 |
}; |
}; |
| 545 |
|
|
| 546 |
|
|