- Timestamp:
- Oct 1, 2013 9:41:01 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/pjsua2/pjsip/include/pjsua2/account.hpp
r4597 r4608 25 25 */ 26 26 #include <pjsua-lib/pjsua.h> 27 #include <pjsua2/types.hpp> 27 28 28 29 /** … … 37 38 */ 38 39 40 /** PJSUA2 API is inside pj namespace */ 41 namespace pj 42 { 43 using std::string; 44 using std::vector; 45 39 46 /** 40 47 * Account registration config. This will be specified in AccountConfig. … … 49 56 * value is empty, no account registration will be performed. 50 57 */ 51 String registrarUri;58 string registrarUri; 52 59 53 60 /** … … 64 71 * request. 65 72 */ 66 S tringVector headers;73 SipHeaderVector headers; 67 74 68 75 /** … … 102 109 * Default: PJSIP_REGISTER_CLIENT_DELAY_BEFORE_REFRESH, 5 seconds 103 110 */ 104 unsigned delayBeforeRefresh ;111 unsigned delayBeforeRefreshSec; 105 112 106 113 /** … … 122 129 123 130 /** 124 * Specify whether REGISTER requests will use the proxy settings 125 * of this account. If zero, the REGISTER request will not have any 126 * Route headers. 127 * 128 * Default: 1 (use account proxy) 131 * Specify how the registration uses the outbound and account proxy 132 * settings. This controls if and what Route headers will appear in 133 * the REGISTER request of this account. The value is bitmask combination 134 * of PJSUA_REG_USE_OUTBOUND_PROXY and PJSUA_REG_USE_ACC_PROXY bits. 135 * If the value is set to 0, the REGISTER request will not use any proxy 136 * (i.e. it will not have any Route headers). 137 * 138 * Default: 3 (PJSUA_REG_USE_OUTBOUND_PROXY | PJSUA_REG_USE_ACC_PROXY) 129 139 */ 130 140 unsigned proxyUse; … … 241 251 */ 242 252 pjsua_sip_timer_use timerUse; 253 254 /** 255 * Specify minimum Session Timer expiration period, in seconds. 256 * Must not be lower than 90. Default is 90. 257 */ 258 unsigned timerMinSESec; 259 260 /** 261 * Specify Session Timer expiration period, in seconds. 262 * Must not be lower than timerMinSE. Default is 1800. 263 */ 264 unsigned timerSessExpiresSec; 265 243 266 }; 244 267 … … 252 275 * subscription request. 253 276 */ 254 S tringVector subHeaders;277 SipHeaderVector headers; 255 278 256 279 /** … … 390 413 */ 391 414 bool iceNoRtcp; 415 416 /** 417 * Always send re-INVITE/UPDATE after ICE negotiation regardless of whether 418 * the default ICE transport address is changed or not. When this is set 419 * to False, re-INVITE/UPDATE will be sent only when the default ICE 420 * transport address is changed. 421 * 422 * Default: yes 423 */ 424 bool iceAlwaysUpdate; 392 425 393 426 /** … … 440 473 * Default: TRUE 441 474 */ 442 bool contactRewriteEnabled;475 int contactRewriteUse; 443 476 444 477 /** 445 478 * Specify how Contact update will be done with the registration, if 446 * contactRewriteEnabled is enabled. 447 * 448 * If set to 1, the Contact update will be done by sending unregistration 449 * to the currently registered Contact, while simultaneously sending new 450 * registration (with different Call-ID) for the updated Contact. 451 * 452 * If set to 2, the Contact update will be done in a single, current 453 * registration session, by removing the current binding (by setting its 454 * Contact's expires parameter to zero) and adding a new Contact binding, 455 * all done in a single request. 456 * 457 * Value 1 is the legacy behavior. 458 * 459 * Default value: PJSUA_CONTACT_REWRITE_METHOD (2) 479 * \a contactRewriteEnabled is enabled. The value is bitmask combination of 480 * \a pjsua_contact_rewrite_method. See also pjsua_contact_rewrite_method. 481 * 482 * Value PJSUA_CONTACT_REWRITE_UNREGISTER(1) is the legacy behavior. 483 * 484 * Default value: PJSUA_CONTACT_REWRITE_METHOD 485 * (PJSUA_CONTACT_REWRITE_NO_UNREG | PJSUA_CONTACT_REWRITE_ALWAYS_UPDATE) 460 486 */ 461 487 int contactRewriteMethod; … … 469 495 * Default: TRUE 470 496 */ 471 bool viaRewriteEnabled; 497 int viaRewriteUse; 498 499 /** 500 * This option controls whether the IP address in SDP should be replaced 501 * with the IP address found in Via header of the REGISTER response, ONLY 502 * when STUN and ICE are not used. If the value is FALSE (the original 503 * behavior), then the local IP address will be used. If TRUE, and when 504 * STUN and ICE are disabled, then the IP address found in registration 505 * response will be used. 506 * 507 * Default: PJ_FALSE (no) 508 */ 509 int sdpNatRewriteUse; 472 510 473 511 /** … … 484 522 * Default: TRUE 485 523 */ 486 bool sipOutboundEnabled;524 int sipOutboundUse; 487 525 488 526 /** … … 531 569 { 532 570 /** 533 * Media transport configuration.571 * Media transport (RTP) configuration. 534 572 */ 535 573 TransportConfig transportConfig; … … 574 612 */ 575 613 int srtpSecureSignaling; 576 }; 577 578 /** 579 * Video stream rate control config. This will be specified in 580 * AccountVideoConfig. 581 */ 582 struct VidRateControlConfig 583 { 584 /** 585 * Rate control method. 586 * 587 * Default: PJMEDIA_VID_STREAM_RC_SIMPLE_BLOCKING. 588 */ 589 pjmedia_vid_stream_rc_method method; 590 591 /** 592 * Upstream/outgoing bandwidth. If this is set to zero, the video stream 593 * will use codec maximum bitrate setting. 594 * 595 * Default: 0 (follow codec maximum bitrate). 596 */ 597 unsigned bandwidth; 598 599 /** Default constructor */ 600 VidRateControlConfig(); 601 602 /** Convert to pj */ 603 pjmedia_vid_stream_rc_config toPj() const; 604 605 /** Convert from pj */ 606 void fromPj(const pjmedia_vid_stream_rc_config &prm); 614 615 /** 616 * Specify whether IPv6 should be used on media. Default is not used. 617 */ 618 pjsua_ipv6_use ipv6Use; 607 619 }; 608 620 … … 626 638 * Default: False 627 639 */ 628 bool autoShowIncoming;640 bool autoShowIncoming; 629 641 630 642 /** … … 641 653 * Default: False 642 654 */ 643 bool autoTransmitOutgoing;655 bool autoTransmitOutgoing; 644 656 645 657 /** … … 649 661 * Default: 0 650 662 */ 651 unsigned windowFlags;663 unsigned windowFlags; 652 664 653 665 /** … … 658 670 * Default: PJMEDIA_VID_DEFAULT_CAPTURE_DEV 659 671 */ 660 pjmedia_vid_dev_index defaultCaptureDevice;672 pjmedia_vid_dev_index defaultCaptureDevice; 661 673 662 674 /** … … 665 677 * Default: PJMEDIA_VID_DEFAULT_RENDER_DEV 666 678 */ 667 pjmedia_vid_dev_index defaultRenderDevice; 668 669 /** 670 * Specify the send rate control for video stream. 671 */ 672 VidRateControlConfig rateControlConfig; 679 pjmedia_vid_dev_index defaultRenderDevice; 680 681 /** 682 * Rate control method. 683 * 684 * Default: PJMEDIA_VID_STREAM_RC_SIMPLE_BLOCKING. 685 */ 686 pjmedia_vid_stream_rc_method rateControlMethod; 687 688 /** 689 * Upstream/outgoing bandwidth. If this is set to zero, the video stream 690 * will use codec maximum bitrate setting. 691 * 692 * Default: 0 (follow codec maximum bitrate). 693 */ 694 unsigned rateControlBandwidth; 673 695 }; 674 696 … … 692 714 * This field is mandatory. 693 715 */ 694 String uri;716 string idUri; 695 717 696 718 /** … … 734 756 AccountVideoConfig videoConfig; 735 757 758 public: 736 759 /** 737 760 * Default constructor will initialize with default values. … … 740 763 741 764 /** 742 * Convert to pjsip. 765 * This will return a temporary pjsua_acc_config instance, which contents 766 * are only valid as long as this AccountConfig structure remains valid 767 * AND no modifications are done to it AND no further toPj() function call 768 * is made. Any call to toPj() function will invalidate the content of 769 * temporary pjsua_acc_config that was returned by the previous call. 743 770 */ 744 771 pjsua_acc_config toPj() const; … … 747 774 * Initialize from pjsip. 748 775 */ 749 void fromPj(const pjsua_acc_config &prm); 776 void fromPj(const pjsua_acc_config &prm, const pjsua_media_config *mcfg); 777 778 }; 779 780 /** 781 * This describes account presence status. 782 */ 783 struct AccountPresenceStatus 784 { 785 /** Basic status. */ 786 bool isOnline; 787 788 /** Activity type. */ 789 pjrpid_activity activity; 790 791 /** Optional text describing the person/element. */ 792 string note; 793 794 /** Optional RPID ID string. */ 795 string rpidId; 796 797 public: 798 AccountPresenceStatus(); 750 799 }; 751 800 … … 821 870 822 871 /** 823 * This structure contains parameters for onIncomingCall() callback. 824 */ 825 struct IncomingCallParam 826 { 827 // rdata 828 }; 829 830 /** 831 * This structure contains parameters for onRegState() callback. 832 */ 833 struct RegStateParam 834 { 835 // reginfo 872 * This structure contains parameters for onIncomingCall() account callback. 873 */ 874 struct OnIncomingCallParam 875 { 876 /** 877 * The library call index allocated for the new call. 878 */ 879 int callIndex; 880 881 /** 882 * The incoming INVITE request. 883 */ 884 SipRxData rdata; 885 }; 886 887 /** 888 * This structure contains parameters for onRegStarted() account callback. 889 */ 890 struct OnRegStartedParam 891 { 892 /** 893 * True for registration and False for unregistration. 894 */ 895 bool renew; 896 }; 897 898 /** 899 * This structure contains parameters for onRegState() account callback. 900 */ 901 struct OnRegStateParam 902 { 903 /** 904 * Registration operation status. 905 */ 906 pj_status_t status; 907 908 /** 909 * SIP status code received. 910 */ 911 int code; 912 913 /** 914 * SIP reason phrase received. 915 */ 916 pj_str_t reason; 917 918 /** 919 * The incoming message. 920 */ 921 SipRxData rdata; 922 923 /** 924 * Next expiration interval. 925 */ 926 int expiration; 836 927 }; 837 928 … … 839 930 * This structure contains parameters for onIncomingSubscribe() callback. 840 931 */ 841 struct IncomingSubscribeParam 842 { 843 /* 844 * @param srv_pres Server presence subscription instance. If 845 * application delays the acceptance of the request, 846 * it will need to specify this object when calling 847 * #pjsua_pres_notify(). 848 * @param acc_id Account ID most appropriate for this request. 849 * @param buddy_id ID of the buddy matching the sender of the 850 * request, if any, or PJSUA_INVALID_ID if no 851 * matching buddy is found. 852 * @param from The From URI of the request. 853 * @param rdata The incoming request. 854 * @param code The status code to respond to the request. The 855 * default value is 200. Application may set this 856 * to other final status code to accept or reject 857 * the request. 858 * @param reason The reason phrase to respond to the request. 859 * @param msg_data If the application wants to send additional 860 * headers in the response, it can put it in this 861 * parameter. 862 */ 863 864 //pjsua_srv_pres *srv_pres, 865 // pjsua_buddy_id buddy_id, 866 // const pj_str_t *from, 867 // pjsip_rx_data *rdata, 868 // pjsua_msg_data *msg_data 932 struct OnIncomingSubscribeParam 933 { 934 /** 935 * Sender URI. 936 */ 937 string fromUri; 938 939 /** 940 * The incoming message. 941 */ 942 SipRxData rdata; 869 943 870 944 /** … … 873 947 * reject the request. 874 948 */ 875 pjsip_status_code 949 pjsip_status_code code; 876 950 877 951 /** 878 952 * The reason phrase to respond to the request. 879 953 */ 880 string reason; 954 string reason; 955 956 /** 957 * Additional data to be sent with the response, if any. 958 */ 959 SipTxOption txOption; 960 }; 961 962 /** 963 * Parameters for onInstantMessage() account callback. 964 */ 965 struct OnInstantMessageParam 966 { 967 /** 968 * Sender From URI. 969 */ 970 string fromUri; 971 972 /** 973 * To URI of the request. 974 */ 975 string toUri; 976 977 /** 978 * Contact URI of the sender. 979 */ 980 string contactUri; 981 982 /** 983 * MIME type of the message body. 984 */ 985 string contentType; 986 987 /** 988 * The message body. 989 */ 990 string msgBody; 991 992 /** 993 * The whole message. 994 */ 995 SipRxData rdata; 996 }; 997 998 /** 999 * Parameters for onInstantMessageStatus() account callback. 1000 */ 1001 struct OnInstantMessageStatusParam 1002 { 1003 /** 1004 * Token or a user data that was associated with the pager 1005 * transmission. 1006 */ 1007 Token userData; 1008 1009 /** 1010 * Destination URI. 1011 */ 1012 string toUri; 1013 1014 /** 1015 * The message body. 1016 */ 1017 string msgBody; 1018 1019 /** 1020 * The SIP status code of the transaction. 1021 */ 1022 pjsip_status_code status; 1023 1024 /** 1025 * The reason phrase of the transaction. 1026 */ 1027 string reason; 1028 1029 /** 1030 * The incoming response that causes this callback to be called. 1031 * If the transaction fails because of time out or transport error, 1032 * the content will be empty. 1033 */ 1034 SipRxData rdata; 1035 }; 1036 1037 /** 1038 * Parameters for onTypingIndication() account callback. 1039 */ 1040 struct OnTypingIndicationParam 1041 { 1042 /** 1043 * Sender/From URI. 1044 */ 1045 string fromUri; 1046 1047 /** 1048 * To URI. 1049 */ 1050 string toUri; 1051 1052 /** 1053 * The Contact URI. 1054 */ 1055 string contactUri; 1056 1057 /** 1058 * Boolean to indicate if sender is typing. 1059 */ 1060 bool isTyping; 1061 1062 /** 1063 * The whole message buffer. 1064 */ 1065 SipRxData rdata; 1066 }; 1067 1068 /** 1069 * Parameters for onMwiInfo() account callback. 1070 */ 1071 struct OnMwiInfoParam 1072 { 1073 /** 1074 * MWI subscription state. 1075 */ 1076 pjsip_evsub_state state; 1077 1078 /** 1079 * The whole message buffer. 1080 */ 1081 SipRxData rdata; 881 1082 }; 882 1083 … … 895 1096 * @param prm Callback parameter. 896 1097 */ 897 virtual void onIncomingCall(IncomingCallParam &prm) 1098 virtual void onIncomingCall(OnIncomingCallParam &prm) 1099 {} 1100 1101 /** 1102 * Notify application when registration or unregistration has been 1103 * initiated. Note that this only notifies the initial registration 1104 * and unregistration. Once registration session is active, subsequent 1105 * refresh will not cause this callback to be called. 1106 * 1107 * @param prm Callback parameter. 1108 */ 1109 virtual void onRegStarted(OnRegStartedParam &prm) 898 1110 {} 899 1111 … … 903 1115 * registration details. 904 1116 * 905 * @param acc_id The account ID.906 */ 907 virtual void onRegState( RegStateParam &prm)1117 * @param prm Callback parameter. 1118 */ 1119 virtual void onRegState(OnRegStateParam &prm) 908 1120 {} 909 1121 … … 937 1149 * Application MUST return from this callback immediately (e.g. it must 938 1150 * not block in this callback while waiting for user confirmation). 939 */ 940 virtual void onIncomingSubscribe(IncomingSubscribeParam &prm) 1151 * 1152 * @param prm Callback parameter. 1153 */ 1154 virtual void onIncomingSubscribe(OnIncomingSubscribeParam &prm) 941 1155 {} 942 1156 1157 /** 1158 * Notify application on incoming instant message or pager (i.e. MESSAGE 1159 * request) that was received outside call context. 1160 * 1161 * @param prm Callback parameter. 1162 */ 1163 virtual void onInstantMessage(OnInstantMessageParam &prm) 1164 {} 1165 1166 /** 1167 * Notify application about the delivery status of outgoing pager/instant 1168 * message (i.e. MESSAGE) request. 1169 * 1170 * @param prm Callback parameter. 1171 */ 1172 virtual void onInstantMessageStatus(OnInstantMessageStatusParam &prm) 1173 {} 1174 1175 /** 1176 * Notify application about typing indication. 1177 * 1178 * @param prm Callback parameter. 1179 */ 1180 virtual void onTypingIndication(OnTypingIndicationParam &prm) 1181 {} 1182 1183 /** 1184 * Notification about MWI (Message Waiting Indication) status change. 1185 * This callback can be called upon the status change of the 1186 * SUBSCRIBE request (for example, 202/Accepted to SUBSCRIBE is received) 1187 * or when a NOTIFY reqeust is received. 1188 * 1189 * @param prm Callback parameter. 1190 */ 1191 virtual void onMwiInfo(OnMwiInfoParam &prm) 1192 {} 943 1193 }; 944 1194 … … 960 1210 { 961 1211 public: 962 void setTransport(); 1212 /** 1213 * Check if this account is still valid. 1214 * 1215 * @return True if it is. 1216 */ 1217 bool isValid() const; 1218 1219 /** 1220 * Set this as default account to be used when incoming and outgoing 1221 * requests don't match any accounts. 1222 * 1223 * @return PJ_SUCCESS on success. 1224 */ 1225 void setDefault() throw(Error); 1226 1227 /** 1228 * Check if this account is the default account. Default account will be 1229 * used for incoming and outgoing requests that don't match any other 1230 * accounts. 1231 * 1232 * @return True if this is the default account. 1233 */ 1234 bool isDefault() const; 1235 1236 /** 1237 * Get PJSUA-LIB account ID or index associated with this account. 1238 * 1239 * @return Integer greater than or equal to zero. 1240 */ 1241 int getIndex() const; 1242 1243 /** 1244 * Set arbitrary data to be associated with the account. 1245 * 1246 * @param user_data User/application data. 1247 */ 1248 void setUserData(Token user_data); 1249 1250 /** 1251 * Get the user data that was associated with the account. 1252 * 1253 * @return The user data. 1254 */ 1255 Token getUserData() const; 1256 1257 /** 1258 * Get account info. 1259 * 1260 * @return Account info. 1261 */ 1262 AccountInfo getInfo() const; 1263 1264 /** 1265 * Modify the account to use the specified account configuration. 1266 * Depending on the changes, this may cause unregistration or 1267 * reregistration on the account. 1268 * 1269 * @param cfg New account config to be applied to the account. 1270 */ 1271 void modify(const AccountConfig &acc) throw(Error); 1272 1273 /** 1274 * Update registration or perform unregistration. Application normally 1275 * only needs to call this function if it wants to manually update the 1276 * registration or to unregister from the server. 1277 * 1278 * @param renew If False, this will start unregistration 1279 * process. 1280 */ 1281 void setRegistration(bool renew) throw(Error); 1282 1283 /** 1284 * Set or modify account's presence online status to be advertised to 1285 * remote/presence subscribers. This would trigger the sending of 1286 * outgoing NOTIFY request if there are server side presence subscription 1287 * for this account, and/or outgoing PUBLISH if presence publication is 1288 * enabled for this account. 1289 * 1290 * @param pres_st Presence online status. 1291 */ 1292 void setOnlineStatus(const AccountPresenceStatus &pres_st) throw(Error); 1293 1294 /** 1295 * Lock/bind this account to a specific transport/listener. Normally 1296 * application shouldn't need to do this, as transports will be selected 1297 * automatically by the library according to the destination. 1298 * 1299 * When account is locked/bound to a specific transport, all outgoing 1300 * requests from this account will use the specified transport (this 1301 * includes SIP registration, dialog (call and event subscription), and 1302 * out-of-dialog requests such as MESSAGE). 1303 * 1304 * Note that transport id may be specified in AccountConfig too. 1305 * 1306 * @param tp_id The transport ID. 1307 */ 1308 void setTransport(TransportId tp_id) throw(Error); 963 1309 964 1310 protected: … … 968 1314 }; 969 1315 1316 } // namespace pj 1317 970 1318 /** 971 1319 * @} // PJSUA2_ACC
Note: See TracChangeset
for help on using the changeset viewer.