1%% 2%% %CopyrightBegin% 3%% 4%% Copyright Ericsson AB 2003-2019. All Rights Reserved. 5%% 6%% Licensed under the Apache License, Version 2.0 (the "License"); 7%% you may not use this file except in compliance with the License. 8%% You may obtain a copy of the License at 9%% 10%% http://www.apache.org/licenses/LICENSE-2.0 11%% 12%% Unless required by applicable law or agreed to in writing, software 13%% distributed under the License is distributed on an "AS IS" BASIS, 14%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15%% See the License for the specific language governing permissions and 16%% limitations under the License. 17%% 18%% %CopyrightEnd% 19%% 20 21%% 22%%---------------------------------------------------------------------- 23%% Purpose: Handle meta data about packages 24%%---------------------------------------------------------------------- 25 26-module(megaco_binary_name_resolver_v2). 27 28-include_lib("megaco/src/engine/megaco_message_internal.hrl"). 29-include_lib("megaco/src/app/megaco_internal.hrl"). 30 31-define(LOWER(Char), 32 if 33 Char >= $A, Char =< $Z -> 34 Char - ($A - $a); 35 true -> 36 Char 37 end). 38 39-export([packages/0, 40 capabilities/0, 41 capabilities/1, 42 decode_name/3, 43 encode_name/3 44 ]). 45 46encode_name(Config, term_id, TermId) -> 47 case megaco:encode_binary_term_id(Config, TermId) of 48 {ok, TermId2} -> 49 TermId2; 50 {error, _Reason} -> 51 exit({bad_term_id, TermId}) 52 end; 53encode_name(_Config, Scope, Item) -> 54 ?d("encode_name(~p) -> entry with" 55 "~n Item: ~p", [Scope, Item]), 56 encode(Scope, Item). 57 58decode_name(Config, term_id, TermId) -> 59 case megaco:decode_binary_term_id(Config, TermId) of 60 {ok, TermId2} -> 61 TermId2; 62 {error, _Reason} -> 63 exit({bad_term_id, TermId}) 64 end; 65decode_name(_Config, Scope, Item) -> 66 ?d("decode_name(~p) -> entry with" 67 "~n Item: ~p", [Scope, Item]), 68 decode(Scope, Item). 69 70%%---------------------------------------------------------------------- 71%% 12.1.1 Package 72%% 73%% Overall description of the package, specifying: 74%% 75%% Package Name: only descriptive 76%% 77%% PackageID: is an identifier 78%% 79%% Description: 80%% 81%% Version: 82%% 83%% A new version of a package can only add additional Properties, 84%% Events, Signals, Statistics and new possible values for an existing 85%% parameter described in the original package. No deletions or 86%% modifications shall be allowed. A version is an integer in the range 87%% from 1 to 99. 88%% 89%% Designed to be extended only (Optional): Yes 90%% 91%% This indicates that the package has been expressly designed to be 92%% extended by others, not to be directly referenced. For example, the 93%% package may not have any function on its own or be nonsensical on its 94%% own. The MG SHOULD NOT publish this PackageID when reporting 95%% packages. 96%% 97%% Extends (Optional): existing package Descriptor 98%% 99%% A package may extend an existing package. The version of the original 100%% package must be specified. When a package extends another package it 101%% shall only add additional Properties, Events, Signals, Statistics and 102%% new possible values for an existing parameter described in the 103%% original package. An extended package shall not redefine or overload 104%% an identifier defined in the original package and packages it may 105%% have extended (multiple levels of extension). Hence, if package B 106%% version 1 extends package A version 1, version 2 of B will not be 107%% able to extend the A version 2 if A version 2 defines a name already 108%% in B version 1. 109%% 110%% 111%% 12.1.2 Properties 112%% 113%% Properties defined by the package, specifying: 114%% 115%% Property Name: only descriptive 116%% 117%% PropertyID: is an identifier 118%% 119%% Description: 120%% 121%% Type: One of: 122%% 123%% Boolean 124%% 125%% String: UTF-8 string 126%% 127%% Octet String: A number of octets. See Annex A and Annex B.3 128%% for encoding 129%% 130%% Integer: 4 byte signed integer 131%% 132%% Double: 8 byte signed integer 133%% 134%% Character: unicode UTF-8 encoding of a single letter. Could be 135%% more than one octet. 136%% 137%% Enumeration: one of a list of possible unique values (see 12.3) 138%% 139%% Sub-list: a list of several values from a list. The type of 140%% sub-list SHALL also be specified. The type shall be chosen 141%% from the types specified in this section (with the exception of 142%% sub-list). For example, Type: sub-list of enumeration. The 143%% encoding of sub-lists is specified in Annexes A and B.3. 144%% 145%% Possible values: 146%% 147%% A package MUST specify either a specific set of values or a 148%% description of how values are determined. A package MUST also 149%% specify a default value or the default behaviour when the value is 150%% omitted from its descriptor. For example, a package may specify that 151%% procedures related to the property are suspended when it value is 152%% omitted. A default value (but not procedures) may be specified as 153%% provisionable. 154%% 155%% Defined in: 156%% 157%% Which H.248.1 descriptor the property is defined in. LocalControl is 158%% for stream dependent properties. TerminationState is for stream 159%% independent properties. These are expected to be the most common 160%% cases, but it is possible for properties to be defined in other 161%% descriptors. 162%% 163%% Characteristics: Read/Write or both, and (optionally), global: 164%% 165%% Indicates whether a property is read-only, or read-write, and if it 166%% is global. If Global is omitted, the property is not global. If a 167%% property is declared as global, the value of the property is shared 168%% by all Terminations realizing the package. 169%% 170%% 171%% 12.1.3 Events 172%% 173%% Events defined by the package, specifying: 174%% 175%% Event name: only descriptive 176%% 177%% EventID: is an identifier 178%% 179%% Description: 180%% 181%% EventsDescriptor Parameters: 182%% 183%% Parameters used by the MGC to configure the event, and found in the 184%% EventsDescriptor. See 12.2. 185%% 186%% ObservedEventsDescriptor Parameters: 187%% 188%% Parameters returned to the MGC in Notify requests and in replies to 189%% command requests from the MGC that audit ObservedEventsDescriptor, 190%% and found in the ObservedEventsDescriptor. See 12.2. 191%% 192%% 193%% 12.1.4 Signals 194%% 195%% Signals defined by the package, specifying: 196%% 197%% Signal Name: only descriptive 198%% 199%% SignalID: is an identifier. SignalID is used in a 200%% SignalsDescriptor 201%% 202%% Description 203%% 204%% SignalType: one of: 205%% 206%% OO (On/Off) 207%% 208%% TO (TimeOut) 209%% 210%% BR (Brief) 211%% 212%% NOTE - SignalType may be defined such that it is dependent on the 213%% value of one or more parameters. The package MUST specify a default 214%% signal type. If the default type is TO, the package MUST specify a 215%% default duration which may be provisioned. A default duration is 216%% meaningless for BR. 217%% 218%% Duration: in hundredths of seconds 219%% 220%% Additional Parameters: see 12.2 221%% 222%% 223%% 12.1.5 Statistics 224%% 225%% Statistics defined by the package, specifying: 226%% 227%% Statistic name: only descriptive 228%% 229%% StatisticID: is an identifier 230%% 231%% StatisticID is used in a StatisticsDescriptor 232%% 233%% Description: 234%% 235%% Type: One of: 236%% Boolean 237%% String: UTF-8 string 238%% Octet String: A number of octets. See Annex A and B.3 for encoding 239%% Integer: 4 byte signed integer 240%% Double: 8 byte signed integer 241%% Character: Unicode UTF-8 encoding of a single letter. 242%% Could be more than one octet. 243%% Enumeration: One of a list of possible unique values (see 12.3) 244%% Sub-list: A list of several values from a list. 245%% The type of sub-list SHALL also be specified. 246%% The type shall be chosen from the types specified 247%% in this clause (with the exception of sub-list). 248%% For example, Type: sub-list of enumeration. 249%% The encoding of sub-lists is specified in 250%% Annex A and B.3. 251%% Possible Values: 252%% A package must indicate the unit of measure, e.g., 253%% milliseconds, packets, either here or along with the type 254%% above, as well as indicating any restriction on the range. 255%% 256%% 257%% 12.1.6 Procedures 258%% 259%% Additional guidance on the use of the package. 260%% 261%% 262%% 12.2 Guidelines to defining Parameters to Events and Signals 263%% 264%% Parameter Name: only descriptive 265%% 266%% ParameterID: is an identifier. The textual ParameterID of 267%% parameters to Events and Signals shall not start with "EPA" and 268%% "SPA", respectively. The textual ParameterID shall also not be 269%% "ST", "Stream", "SY", "SignalType", "DR", "Duration", "NC", 270%% "NotifyCompletion", "KA", "Keepactive", "EB", "Embed", "DM" or 271%% "DigitMap". 272%% 273%% Type: One of: 274%% 275%% Boolean 276%% 277%% String: UTF-8 octet string 278%% 279%% Octet String: A number of octets. See Annex A and Annex B.3 280%% for encoding 281%% 282%% Integer: 4-octet signed integer 283%% 284%% Double: 8-octet signed integer 285%% 286%% Character: unicode UTF-8 encoding of a single letter. Could be 287%% more than one octet. 288%% 289%% Enumeration: one of a list of possible unique values (see 12.3) 290%% 291%% Sub-list: a list of several values from a list (not supported 292%% for statistics). The type of sub-list SHALL also be specified. 293%% The type shall be chosen from the types specified in this 294%% section (with the exception of sub-list). For example, Type: 295%% sub-list of enumeration. The encoding of sub-lists is 296%% specified in Annexes A and B.3. 297%% 298%% Possible values: 299%% 300%% A package MUST specify either a specific set of values or a 301%% description of how values are determined. A package MUST also 302%% specify a default value or the default behavior when the value is 303%% omitted from its descriptor. For example, a package may specify that 304%% procedures related to the parameter are suspended when it value is 305%% omitted. A default value (but not procedures) may be specified as 306%% provisionable. 307%% 308%% Description: 309%% 310%% 311%% 12.3 Lists 312%% 313%% Possible values for parameters include enumerations. Enumerations may 314%% be defined in a list. It is recommended that the list be IANA 315%% registered so that packages that extend the list can be defined 316%% without concern for conflicting names. 317%% 318%% 319%% 12.4 Identifiers 320%% 321%% Identifiers in text encoding shall be strings of up to 64 characters, 322%% containing no spaces, starting with an alphabetic character and 323%% consisting of alphanumeric characters and/or digits, and possibly 324%% including the special character underscore ("_"). 325%% 326%% Identifiers in binary encoding are 2 octets long. 327%% 328%% Both text and binary values shall be specified for each identifier, 329%% including identifiers used as values in enumerated types. 330%% 331%% 332%% 12.5 Package registration 333%% 334%% A package can be registered with IANA for interoperability reasons. 335%% See clause 14 for IANA considerations. 336%% 337%%---------------------------------------------------------------------- 338 339capabilities() -> 340 [{P, capabilities(P)} || P <- packages()]. 341 342%% -record(property, {name, type, values, defined_in, characteristics}). 343 344%%---------------------------------------------------------------------- 345%% List all known packages 346%% 'native' and 'all' are not real packages 347%%---------------------------------------------------------------------- 348 349packages() -> 350 [ 351 "g", % Generic 352 "root", % Base Root Package 353 "tonegen", % Tone Generator Package 354 "tonedet", % Tone Detection Package 355 "dg", % Basic DTMF Generator Package 356 "dd", % DTMF detection Package 357 "cg", % Call Progress Tones Generator Package 358 "cd", % Call Progress Tones Detection Package 359 "al", % Analog Line Supervision Package 360 "ct", % Basic Continuity Package 361 "nt", % Network Package 362 "rtp", % RTP Package 363 "swb", % SwitchBoard Package 364 "tdmc", % TDM Circuit Package 365 "" % Native pseudo package 366 ]. 367 368%%---------------------------------------------------------------------- 369%% List all matching capabilities 370%%---------------------------------------------------------------------- 371 372capabilities(Package) -> 373 case Package of 374 "g" -> capabilities_g(); 375 "root" -> capabilities_root(); 376 "tonegen" -> capabilities_tonegen(); 377 "tonedet" -> capabilities_tonedet(); 378 "dg" -> capabilities_dg(); 379 "dd" -> capabilities_dd(); 380 "cg" -> capabilities_cg(); 381 "cd" -> capabilities_cd(); 382 "al" -> capabilities_al(); 383 "ct" -> capabilities_ct(); 384 "nt" -> capabilities_nt(); 385 "rtp" -> capabilities_rtp(); 386 "swb" -> capabilities_swb(); 387 "tdmc" -> capabilities_tdmc(); 388 "" -> capabilities_native() 389 end. 390 391%%---------------------------------------------------------------------- 392%% Decode package name to internal form 393%% Scope ::= property | event | signal | statistics 394%%---------------------------------------------------------------------- 395 396decode(mid, Package) -> 397 decode_mid(Package); 398decode(package, Package) -> 399 decode_package(Package); 400decode(profile, Package) -> 401 decode_profile(Package); 402decode(dialplan, Dialplan) -> 403 decode_dialplan(Dialplan); 404decode(Scope, [A, B | Item]) when is_atom(Scope) -> 405 ?d("decode(~p) -> entry with" 406 "~n A: ~p" 407 "~n B: ~p" 408 "~n Item: ~p", [Scope, A, B, Item]), 409 case decode_package([A, B]) of 410 "" -> 411 ?d("decode -> \"no\" package",[]), 412 decode_item(Scope, [A, B], Item); 413 Package -> 414 ?d("decode -> Package: ~p", [Package]), 415 Package ++ "/" ++ decode_item(Scope, [A, B], Item) 416 end; 417decode({Scope, [A, B | Item]}, SubItem) when is_atom(Scope) -> 418 ?d("decode(~p) -> entry with" 419 "~n A: ~p" 420 "~n B: ~p" 421 "~n Item: ~p" 422 "~n SubItem: ~p", [Scope, A, B, Item, SubItem]), 423 decode_item({Scope, Item}, [A, B], SubItem). 424 425decode_item(Scope, [A, B], Item) -> 426 ?d("decode_item -> entry",[]), 427 case A of 428 16#00 -> 429 case B of 430 16#01 -> decode_g(Scope, Item); 431 16#02 -> decode_root(Scope, Item); 432 16#03 -> decode_tonegen(Scope, Item); 433 16#04 -> decode_tonedet(Scope, Item); 434 16#05 -> decode_dg(Scope, Item); 435 16#06 -> decode_dd(Scope, Item); 436 16#07 -> decode_cg(Scope, Item); 437 16#08 -> decode_cd(Scope, Item); 438 16#09 -> decode_al(Scope, Item); 439 16#0a -> decode_ct(Scope, Item); 440 16#0b -> decode_nt(Scope, Item); 441 16#0c -> decode_rtp(Scope, Item); 442 16#0d -> decode_tdmc(Scope, Item); 443 16#00 -> decode_native(Scope, Item) 444 end; 445 16#fe -> 446 case B of 447 %% Proprietary extension 448 16#fe -> decode_swb(Scope, Item) 449 end; 450 16#ff -> 451 case B of 452 16#ff when Item =:= [16#ff, 16#ff] -> "*" 453 end 454 end. 455 456decode_package(Package) -> 457 ?d("decode_package -> entry with" 458 "~n Package: ~p", [Package]), 459 [A, B] = Package, 460 case A of 461 16#00 -> 462 case B of 463 16#01 -> "g"; 464 16#02 -> "root"; 465 16#03 -> "tonegen"; 466 16#04 -> "tonedet"; 467 16#05 -> "dg"; 468 16#06 -> "dd"; 469 16#07 -> "cg"; 470 16#08 -> "cd"; 471 16#09 -> "al"; 472 16#0a -> "ct"; 473 16#0b -> "nt"; 474 16#0c -> "rtp"; 475 16#0d -> "tdmc"; 476 16#00 -> "" 477 end; 478 16#fe -> 479 case B of 480 16#fe -> "swb" 481 end; 482 16#ff -> 483 case B of 484 16#ff -> "*" 485 end 486 end. 487 488decode_profile([A, B]) -> 489 case A of 490 16#00 -> 491 case B of 492 16#fe -> "resgw"; 493 _ -> "profile" ++ [A + $0, B + $0] 494 end; 495 _ -> 496 "profile" ++ [A + $0, B + $0] 497 end. 498 499decode_dialplan([A, B]) -> 500 "dialplan" ++ [A + $0, B + $0]. 501 502decode_mid(Mid) -> 503 case Mid of 504 {domainName, DN} -> 505 Lower = to_lower(DN#'DomainName'.name), 506 {domainName, DN#'DomainName'{name = Lower}}; 507 {deviceName, PathName} -> 508 Lower = to_lower(PathName), 509 {deviceName, Lower}; 510 Other -> 511 Other 512 end. 513 514to_lower(Chars) -> 515 [?LOWER(Char) || Char <- Chars]. 516 517%%---------------------------------------------------------------------- 518%% Encode package name from internal form 519%% Scope ::= property | event | signal | statistics 520%%---------------------------------------------------------------------- 521 522encode(mid, Package) -> 523 encode_mid(Package); 524encode(package, Package) -> 525 encode_package(Package); 526encode(profile, Profile) -> 527 encode_profile(Profile); 528encode(dialplan, Dialplan) -> 529 encode_dialplan(Dialplan); 530encode(Scope, PackageItem) when is_atom(Scope) -> 531 ?d("encode(~p) -> entry with" 532 "~n PackageItem: ~p", [Scope, PackageItem]), 533 case string:tokens(PackageItem, [$/]) of 534 [Package, Item] -> 535 ?d("encode -> " 536 "~n Package: ~p" 537 "~n Item: ~p", [Package, Item]), 538 encode_package(Package) ++ encode_item(Scope, Package, Item); 539 [Item] -> 540 ?d("encode -> Item: ~p", [Item]), 541 [16#00, 16#00 | encode_native(Scope, Item)] 542 end; 543encode({Scope, PackageItem}, SubItem) when is_atom(Scope) -> 544 ?d("encode(~p) -> entry with" 545 "~n PackageItem: ~p" 546 "~n SubItem: ~p", [Scope, PackageItem, SubItem]), 547 case string:tokens(PackageItem, [$/]) of 548 [Package, Item] -> 549 ?d("encode -> " 550 "~n Package: ~p" 551 "~n Item: ~p", [Package, Item]), 552 encode_item({Scope, Item}, Package, SubItem); 553 [_Item] -> 554 ?d("encode -> _Item: ~p", [_Item]), 555 encode_native(Scope, SubItem) 556 end. 557 558encode_item(_Scope, _Package, "*") -> 559 [16#ff, 16#ff]; 560encode_item(Scope, Package, Item) -> 561 ?d("encode_item(~s) -> entry", [Package]), 562 case Package of 563 "g" -> encode_g(Scope, Item); 564 "root" -> encode_root(Scope, Item); 565 "tonegen" -> encode_tonegen(Scope, Item); 566 "tonedet" -> encode_tonedet(Scope, Item); 567 "dg" -> encode_dg(Scope, Item); 568 "dd" -> encode_dd(Scope, Item); 569 "cg" -> encode_cg(Scope, Item); 570 "cd" -> encode_cd(Scope, Item); 571 "al" -> encode_al(Scope, Item); 572 "ct" -> encode_ct(Scope, Item); 573 "nt" -> encode_nt(Scope, Item); 574 "rtp" -> encode_rtp(Scope, Item); 575 "tdmc" -> encode_tdmc(Scope, Item); 576 "swb" -> encode_swb(Scope, Item) 577 end. 578 579encode_package(Package) -> 580 case Package of 581 "g" -> [16#00, 16#01]; 582 "root" -> [16#00, 16#02]; 583 "tonegen" -> [16#00, 16#03]; 584 "tonedet" -> [16#00, 16#04]; 585 "dg" -> [16#00, 16#05]; 586 "dd" -> [16#00, 16#06]; 587 "cg" -> [16#00, 16#07]; 588 "cd" -> [16#00, 16#08]; 589 "al" -> [16#00, 16#09]; 590 "ct" -> [16#00, 16#0a]; 591 "nt" -> [16#00, 16#0b]; 592 "rtp" -> [16#00, 16#0c]; 593 "tdmc" -> [16#00, 16#0d]; 594 "" -> [16#00, 16#00]; 595 "*" -> [16#ff, 16#ff]; 596 "swb" -> [16#fe, 16#fe] 597 end. 598 599encode_profile(Profile) -> 600 case Profile of 601 "resgw" -> 602 [16#00, 16#fe]; 603 [$p, $r, $o, $f, $i, $l, $e | Name] -> 604 case Name of 605 [A, B] -> [A - $0, B - $0]; 606 [B] -> [0, B - $0]; 607 [] -> [0, 0] 608 end 609 end. 610 611encode_dialplan(Dialplan) -> 612 case Dialplan of 613 [$d, $i, $a, $l, $p, $l, $a, $n | Name] -> 614 case Name of 615 [A, B] -> [A - $0, B - $0]; 616 [B] -> [0, B - $0]; 617 [] -> [0, 0] 618 end 619 end. 620 621encode_mid(Mid) -> 622 Mid. 623 624 625%%---------------------------------------------------------------------- 626%% Name: g - Generic 627%% Version: 1 628%% Extends: None 629%% Purpose: Generic package for commonly encountered items 630%%---------------------------------------------------------------------- 631 632capabilities_g() -> 633 [ 634 {event, "cause"}, 635 {event, "sc"} 636 ]. 637 638encode_g(event, Item) -> 639 case Item of 640 "cause" -> [16#00, 16#01]; 641 "sc" -> [16#00, 16#02] 642 end; 643 644encode_g({event_parameter, Item}, SubItem) -> 645 case Item of 646 "cause" -> 647 case SubItem of 648 "Generalcause" -> [16#00, 16#01]; 649 "Failurecause" -> [16#00, 16#02] 650 end; 651 "sc" -> 652 case SubItem of 653 "SigID" -> [16#00, 16#01]; 654 "Meth" -> [16#00, 16#02]; 655 "SLID" -> [16#00, 16#03] 656 end 657 end. 658 659decode_g(event, Item) -> 660 case Item of 661 [16#00, 16#01] -> "cause"; 662 [16#00, 16#02] -> "sc" 663 end; 664 665decode_g({event_parameter, Item}, SubItem) -> 666 case Item of 667 [16#00, 16#01] -> % Event: cause 668 case SubItem of 669 [16#00, 16#01] -> "Generalcause"; 670 [16#00, 16#02] -> "Failurecause" 671 end; 672 673 [16#00, 16#02] -> % Event: sc 674 case SubItem of 675 [16#00, 16#01] -> "SigID"; 676 [16#00, 16#02] -> "Meth"; 677 [16#00, 16#03] -> "SLID" 678 end 679 end. 680 681 682%%---------------------------------------------------------------------- 683%% Name: root - Base Root Package 684%% Version: 1 685%% Extends: None 686%% Purpose: This package defines Gateway wide properties. 687%%---------------------------------------------------------------------- 688 689capabilities_root() -> 690 [ 691 {property, "maxNumberOfContexts"}, 692 {property, "maxTerminationsPerContext"}, 693 {property, "normalMGExecutionTime"}, 694 {property, "normalMGCExecutionTime"}, 695 {property, "MGProvisionalResponseTimerValue"}, 696 {property, "MGCProvisionalResponseTimerValue"}, 697 {property, "MGCOriginatedPendingLimit"}, 698 {property, "MGOriginatedPendingLimit"} 699 ]. 700 701encode_root(Scope, Item) -> 702 case Scope of 703 property -> 704 case Item of 705 "maxNumberOfContexts" -> [16#00, 16#01]; 706 "maxTerminationsPerContext" -> [16#00, 16#02]; 707 "normalMGExecutionTime" -> [16#00, 16#03]; 708 "normalMGCExecutionTime" -> [16#00, 16#04]; 709 "MGProvisionalResponseTimerValue" -> [16#00, 16#05]; 710 "MGCProvisionalResponseTimerValue" -> [16#00, 16#06]; 711 "MGCOriginatedPendingLimit" -> [16#00, 16#07]; 712 "MGOriginatedPendingLimit" -> [16#00, 16#08] 713 end 714 end. 715 716decode_root(Scope, Item) -> 717 case Scope of 718 property -> 719 case Item of 720 [16#00, 16#01] -> "maxNumberOfContexts"; 721 [16#00, 16#02] -> "maxTerminationsPerContext"; 722 [16#00, 16#03] -> "normalMGExecutionTime"; 723 [16#00, 16#04] -> "normalMGCExecutionTime"; 724 [16#00, 16#05] -> "MGProvisionalResponseTimerValue"; 725 [16#00, 16#06] -> "MGCProvisionalResponseTimerValue"; 726 [16#00, 16#07] -> "MGCOriginatedPendingLimit"; 727 [16#00, 16#08] -> "MGOriginatedPendingLimit" 728 end 729 end. 730 731 732%%---------------------------------------------------------------------- 733%% Name: tonegen - Tone Generator Package 734%% Version: 1 735%% Extends: None 736%% Purpose: This package defines signals to generate audio tones. 737%% This package does not specify parameter values. It is 738%% intended to be extendable. Generally, tones are defined 739%% as an individual signal with a parameter, ind, 740%% representing "interdigit" time delay, and a tone id to 741%% be used with playtones. A tone id should be kept 742%% consistent with any tone generation for the same tone. 743%% MGs are expected to be provisioned with the characteristics 744%% of appropriate tones for the country in which the MG is located. 745%%---------------------------------------------------------------------- 746 747capabilities_tonegen() -> 748 [ 749 {signal, "pt"} 750 ]. 751 752encode_tonegen(signal, Item) -> 753 case Item of 754 "pt" -> [16#00, 16#01] 755 end; 756 757encode_tonegen({signal_parameter, Item}, SubItem) -> 758 case Item of 759 "pt" -> 760 case SubItem of 761 "tl" -> [16#00, 16#01]; 762 "ind" -> [16#00, 16#02] 763 end 764 end. 765 766decode_tonegen(signal, Item) -> 767 case Item of 768 [16#00, 16#01] -> "pt" 769 end; 770 771decode_tonegen({signal_parameter, Item}, SubItem) -> 772 case Item of 773 [16#00, 16#01] -> % Event: pt 774 case SubItem of 775 [16#00, 16#01] -> "tl"; 776 [16#00, 16#02] -> "ind" 777 end 778 end. 779 780 781%%---------------------------------------------------------------------- 782%% Name: tonedet - Tone Detection Package 783%% Version: 1 784%% Extends: None 785%% Purpose: This Package defines events for audio tone detection. 786%% Tones are selected by name (tone id). MGs are expected 787%% to be provisioned with the characteristics of appropriate 788%% tones for the country in which the MG is located. 789%% 790%% This package does not specify parameter values. 791%% It is intended to be extendable. 792%%---------------------------------------------------------------------- 793 794capabilities_tonedet() -> 795 [ 796 {event, "std"}, 797 {event, "etd"}, 798 {event, "ltd"} 799 ]. 800 801encode_tonedet(event, Item) -> 802 case Item of 803 "std" -> [16#00, 16#01]; 804 "etd" -> [16#00, 16#02]; 805 "ltd" -> [16#00, 16#03] 806 end; 807 808encode_tonedet({event_parameter, Item}, SubItem) -> 809 case Item of 810 "std" -> 811 case SubItem of 812 "tl" -> [16#00, 16#01]; 813 "tid" -> [16#00, 16#03] 814 end; 815 "etd" -> 816 case SubItem of 817 "tl" -> [16#00, 16#01]; 818 "tid" -> [16#00, 16#03]; 819 "dur" -> [16#00, 16#02] 820 end; 821 "ltd" -> 822 case SubItem of 823 "tl" -> [16#00, 16#01]; 824 "dur" -> [16#00, 16#02]; 825 "tid" -> [16#00, 16#03] 826 end 827 end. 828 829decode_tonedet(event, Item) -> 830 case Item of 831 [16#00, 16#01] -> "std"; 832 [16#00, 16#02] -> "etd"; 833 [16#00, 16#03] -> "ltd" 834 end; 835 836decode_tonedet({event_parameter, Item}, SubItem) -> 837 case Item of 838 [16#00, 16#01] -> % Event std 839 case SubItem of 840 [16#00, 16#01] -> "tl"; 841 [16#00, 16#03] -> "tid" 842 end; 843 [16#00, 16#02] -> % Event etd 844 case SubItem of 845 [16#00, 16#01] -> "tl"; 846 [16#00, 16#03] -> "tid"; 847 [16#00, 16#02] -> "dur" 848 end; 849 [16#00, 16#03] -> % Event ltd 850 case SubItem of 851 [16#00, 16#01] -> "tl"; 852 [16#00, 16#02] -> "dur"; 853 [16#00, 16#03] -> "tid" 854 end 855 end. 856 857%%---------------------------------------------------------------------- 858%% Name: dg - Basic DTMF Generator Package 859%% Version: 1 860%% Extends: tonegen version 1 861%% Purpose: This package defines the basic DTMF tones as signals and 862%% extends the allowed values of parameter tl of playtone 863%% in tonegen. 864%%---------------------------------------------------------------------- 865 866capabilities_dg() -> 867 [ 868 {signal, "d0"}, 869 {signal, "d1"}, 870 {signal, "d2"}, 871 {signal, "d3"}, 872 {signal, "d4"}, 873 {signal, "d5"}, 874 {signal, "d6"}, 875 {signal, "d7"}, 876 {signal, "d8"}, 877 {signal, "d9"}, 878 {signal, "ds"}, 879 {signal, "do"}, 880 {signal, "da"}, 881 {signal, "db"}, 882 {signal, "dc"}, 883 {signal, "dd"} 884 ]. 885 886encode_dg(Scope, Item) -> 887 case Scope of 888 signal -> 889 case Item of 890 "d0" -> [16#00, 16#10]; 891 "d1" -> [16#00, 16#11]; 892 "d2" -> [16#00, 16#12]; 893 "d3" -> [16#00, 16#13]; 894 "d4" -> [16#00, 16#14]; 895 "d5" -> [16#00, 16#15]; 896 "d6" -> [16#00, 16#16]; 897 "d7" -> [16#00, 16#17]; 898 "d8" -> [16#00, 16#18]; 899 "d9" -> [16#00, 16#19]; 900 "ds" -> [16#00, 16#20]; 901 "do" -> [16#00, 16#21]; 902 "da" -> [16#00, 16#1a]; 903 "db" -> [16#00, 16#1b]; 904 "dc" -> [16#00, 16#1c]; 905 "dd" -> [16#00, 16#1d] 906 end 907 end. 908 909decode_dg(Scope, Item) -> 910 case Scope of 911 signal -> 912 case Item of 913 [16#00, 16#10] -> "d0"; 914 [16#00, 16#11] -> "d1"; 915 [16#00, 16#12] -> "d2"; 916 [16#00, 16#13] -> "d3"; 917 [16#00, 16#14] -> "d4"; 918 [16#00, 16#15] -> "d5"; 919 [16#00, 16#16] -> "d6"; 920 [16#00, 16#17] -> "d7"; 921 [16#00, 16#18] -> "d8"; 922 [16#00, 16#19] -> "d9"; 923 [16#00, 16#20] -> "ds"; 924 [16#00, 16#21] -> "do"; 925 [16#00, 16#1a] -> "da"; 926 [16#00, 16#1b] -> "db"; 927 [16#00, 16#1c] -> "dc"; 928 [16#00, 16#1d] -> "dd" 929 end 930 end. 931 932%%---------------------------------------------------------------------- 933%% Name: dd - DTMF detection Package 934%% Version: 1 935%% Extends: tonedet version 1 936%% Purpose: This package defines the basic DTMF tones detection. 937%% Tones are selected by name (tone id). MGs are expected 938%% to be provisioned with the characteristics of appropriate 939%% tones for the country in which the MG is located. 940%% 941%% This package does not specify parameter values. 942%% It is intended to be extendable. 943%% 944%% Additional tone id values are all tone ids described in package dg 945%% (basic DTMF generator package). 946%% 947%% The following table maps DTMF events to digit map symbols as described 948%% in section 7.1.14. 949%% 950%% _________________________________ 951%% | DTMF Event | Symbol | 952%% | d0 | "0" | 953%% | d1 | "1" | 954%% | d2 | "2" | 955%% | d3 | "3" | 956%% | d4 | "4" | 957%% | d5 | "5" | 958%% | d6 | "6" | 959%% | d7 | "7" | 960%% | d8 | "8" | 961%% | d9 | "9" | 962%% | da | "A" or "a"| 963%% | db | "B" or "b"| 964%% | dc | "C" or "c"| 965%% | dd | "D" or "d"| 966%% | ds | "E" or "e"| 967%% | do | "F" or "f"| 968%% |___________________|____________| 969%% 970%%---------------------------------------------------------------------- 971 972capabilities_dd() -> 973 [ 974 {event, "ce"}, 975 {event, "d0"}, 976 {event, "d1"}, 977 {event, "d2"}, 978 {event, "d3"}, 979 {event, "d4"}, 980 {event, "d5"}, 981 {event, "d6"}, 982 {event, "d7"}, 983 {event, "d8"}, 984 {event, "d9"}, 985 {event, "ds"}, 986 {event, "do"}, 987 {event, "da"}, 988 {event, "db"}, 989 {event, "dc"}, 990 {event, "dd"} 991 ]. 992 993encode_dd(event, Item) -> 994 case Item of 995 "ce" -> [16#00, 16#04]; 996 "d0" -> [16#00, 16#10]; 997 "d1" -> [16#00, 16#11]; 998 "d2" -> [16#00, 16#12]; 999 "d3" -> [16#00, 16#13]; 1000 "d4" -> [16#00, 16#14]; 1001 "d5" -> [16#00, 16#15]; 1002 "d6" -> [16#00, 16#16]; 1003 "d7" -> [16#00, 16#17]; 1004 "d8" -> [16#00, 16#18]; 1005 "d9" -> [16#00, 16#19]; 1006 "ds" -> [16#00, 16#20]; 1007 "do" -> [16#00, 16#21]; 1008 "da" -> [16#00, 16#1a]; 1009 "db" -> [16#00, 16#1b]; 1010 "dc" -> [16#00, 16#1c]; 1011 "dd" -> [16#00, 16#1d] 1012 end; 1013 1014encode_dd({event_parameter, Item}, SubItem) -> 1015 case Item of 1016 "ce" -> 1017 case SubItem of 1018 "ds" -> [16#00, 16#01]; 1019 "Meth" -> [16#00, 16#03] 1020 end 1021 end. 1022 1023decode_dd(event, Item) -> 1024 case Item of 1025 [16#00, 16#04] -> "ce"; 1026 [16#00, 16#10] -> "d0"; 1027 [16#00, 16#11] -> "d1"; 1028 [16#00, 16#12] -> "d2"; 1029 [16#00, 16#13] -> "d3"; 1030 [16#00, 16#14] -> "d4"; 1031 [16#00, 16#15] -> "d5"; 1032 [16#00, 16#16] -> "d6"; 1033 [16#00, 16#17] -> "d7"; 1034 [16#00, 16#18] -> "d8"; 1035 [16#00, 16#19] -> "d9"; 1036 [16#00, 16#20] -> "ds"; 1037 [16#00, 16#21] -> "do"; 1038 [16#00, 16#1a] -> "da"; 1039 [16#00, 16#1b] -> "db"; 1040 [16#00, 16#1c] -> "dc"; 1041 [16#00, 16#1d] -> "dd" 1042 end; 1043 1044decode_dd({event_parameter, Item}, SubItem) -> 1045 case Item of 1046 [16#00, 16#04] -> % Event ce 1047 case SubItem of 1048 [16#00, 16#01] -> "ds"; 1049 [16#00, 16#03] -> "Meth" 1050 end 1051 end. 1052 1053%%---------------------------------------------------------------------- 1054%% Name: cg - Call Progress Tones Generator Package 1055%% Version: 1 1056%% Extends: tonegen version 1 1057%% Purpose: This package defines the basic call progress tones as signals 1058%% and extends the allowed values of the tl parameter of 1059%% playtone in tonegen. 1060%%---------------------------------------------------------------------- 1061 1062capabilities_cg() -> 1063 [ 1064 {signal, "dt"}, 1065 {signal, "rt"}, 1066 {signal, "bt"}, 1067 {signal, "ct"}, 1068 {signal, "sit"}, 1069 {signal, "wt"}, 1070 {signal, "prt"}, 1071 {signal, "cw"}, 1072 {signal, "cr"} 1073 ]. 1074 1075 1076encode_cg(Scope, Item) -> 1077 case Scope of 1078 signal -> 1079 case Item of 1080 "dt" -> [16#00, 16#30]; 1081 "rt" -> [16#00, 16#31]; 1082 "bt" -> [16#00, 16#32]; 1083 "ct" -> [16#00, 16#33]; 1084 "sit" -> [16#00, 16#34]; 1085 "wt" -> [16#00, 16#35]; 1086 "prt" -> [16#00, 16#36]; 1087 "cw" -> [16#00, 16#37]; 1088 "cr" -> [16#00, 16#38] 1089 end 1090 end. 1091 1092decode_cg(Scope, Item) -> 1093 case Scope of 1094 signal -> 1095 case Item of 1096 [16#00, 16#30] -> "dt"; 1097 [16#00, 16#31] -> "rt"; 1098 [16#00, 16#32] -> "bt"; 1099 [16#00, 16#33] -> "ct"; 1100 [16#00, 16#34] -> "sit"; 1101 [16#00, 16#35] -> "wt"; 1102 [16#00, 16#36] -> "prt"; 1103 [16#00, 16#37] -> "cw"; 1104 [16#00, 16#38] -> "cr" 1105 end 1106 end. 1107 1108%%---------------------------------------------------------------------- 1109%% Name: cd - Call Progress Tones Detection Package 1110%% Version: 1 1111%% Extends: tonedet version 1 1112%% Purpose: This package defines the basic call progress detection tones. 1113%% This Package extends the possible values of tone id 1114%% in the "start tone detected", "end tone detected" and 1115%% "long tone detected" events. 1116%% Additional values 1117%% tone id values are defined for start tone detected, 1118%% end tone detected and long tone detected with 1119%% the same values as those in package cg (call 1120%% progress tones generation package). 1121%% 1122%% The required set of tone ids corresponds to Recommendation E.180/Q.35 1123%% [ITU-T Recommendation E.180/Q.35 (1998)]. See Recommendation E.180/Q.35 1124%% for definition of the meanings of these tones. 1125%%---------------------------------------------------------------------- 1126 1127capabilities_cd() -> 1128 [ 1129 {event, "dt"}, 1130 {event, "rt"}, 1131 {event, "bt"}, 1132 {event, "ct"}, 1133 {event, "sit"}, 1134 {event, "wt"}, 1135 {event, "prt"}, 1136 {event, "cw"}, 1137 {event, "cr"} 1138 ]. 1139 1140 1141encode_cd(Scope, Item) -> 1142 case Scope of 1143 event -> 1144 case Item of 1145 "dt" -> [16#00, 16#30]; 1146 "rt" -> [16#00, 16#31]; 1147 "bt" -> [16#00, 16#32]; 1148 "ct" -> [16#00, 16#33]; 1149 "sit"-> [16#00, 16#34]; 1150 "wt" -> [16#00, 16#35]; 1151 "prt"-> [16#00, 16#36]; 1152 "cw" -> [16#00, 16#37]; 1153 "cr" -> [16#00, 16#38] 1154 end 1155 end. 1156 1157decode_cd(Scope, Item) -> 1158 case Scope of 1159 event -> 1160 case Item of 1161 [16#00, 16#30] -> "dt"; 1162 [16#00, 16#31] -> "rt"; 1163 [16#00, 16#32] -> "bt"; 1164 [16#00, 16#33] -> "ct"; 1165 [16#00, 16#34] -> "sit"; 1166 [16#00, 16#35] -> "wt"; 1167 [16#00, 16#36] -> "prt"; 1168 [16#00, 16#37] -> "cw"; 1169 [16#00, 16#38] -> "cr" 1170 end 1171 end. 1172 1173%%---------------------------------------------------------------------- 1174%% Name: al - Analog Line Supervision Package 1175%% Version: 1 1176%% Extends: None 1177%% Purpose: This package defines events and signals for an analog line. 1178%%---------------------------------------------------------------------- 1179 1180capabilities_al() -> 1181 [ 1182 {event, "on"}, 1183 {event, "of"}, 1184 {event, "fl"}, 1185 {signal, "ri"} 1186 ]. 1187 1188encode_al(event, Item) -> 1189 ?d("encode_al(event) -> entry with" 1190 "~n Item: ~p", [Item]), 1191 case Item of 1192 "on" -> [16#00, 16#04]; 1193 "of" -> [16#00, 16#05]; 1194 "fl" -> [16#00, 16#06] 1195 end; 1196 1197encode_al({event_parameter, Item}, SubItem) -> 1198 ?d("encode_al({event_parameter,~p}) -> entry with" 1199 "~n SubItem: ~p", [Item, SubItem]), 1200 case Item of 1201 "on" -> 1202 case SubItem of 1203 "strict" -> [16#00, 16#01]; 1204 "init" -> [16#00, 16#02] 1205 end; 1206 "of" -> 1207 case SubItem of 1208 "strict" -> [16#00, 16#01]; 1209 "init" -> [16#00, 16#02] 1210 end; 1211 "fl" -> 1212 case SubItem of 1213 "mindur" -> [16#00, 16#04]; 1214 "maxdur" -> [16#00, 16#05] 1215 end 1216 end; 1217 1218encode_al(signal, Item) -> 1219 ?d("encode_al(signal) -> entry with" 1220 "~n Item: ~p", [Item]), 1221 case Item of 1222 "ri" -> [16#00, 16#02] 1223 end; 1224 1225encode_al({signal_parameter, Item}, SubItem) -> 1226 ?d("encode_al({signal_parameter,~p}) -> entry with" 1227 "~n SubItem: ~p", [Item, SubItem]), 1228 case Item of 1229 "ri" -> 1230 case SubItem of 1231 "cad" -> [16#00, 16#06]; 1232 "freq" -> [16#00, 16#07] 1233 end 1234 end. 1235 1236decode_al(event, SubItem) -> 1237 ?d("decode_al(event) -> entry with" 1238 "~n SubItem: ~p", [SubItem]), 1239 case SubItem of 1240 [16#00, 16#04] -> "on"; 1241 [16#00, 16#05] -> "of"; 1242 [16#00, 16#06] -> "fl" 1243 end; 1244 1245decode_al({event_parameter, Item}, SubItem) -> 1246 ?d("decode_al({event_parameter,~p}) -> entry with" 1247 "~n SubItem: ~p", [Item, SubItem]), 1248 case Item of 1249 [16#00,16#04] -> %% Event: on 1250 case SubItem of 1251 [16#00, 16#01] -> "strict"; 1252 [16#00, 16#02] -> "init" 1253 end; 1254 [16#00,16#05] -> %% Event: of 1255 case SubItem of 1256 [16#00, 16#01] -> "strict"; 1257 [16#00, 16#02] -> "init" 1258 end; 1259 [16#00,16#06] -> %% Event: fl 1260 case SubItem of 1261 [16#00, 16#04] -> "mindur"; 1262 [16#00, 16#05] -> "maxdur" 1263 end 1264 end; 1265 1266decode_al(signal, SubItem) -> 1267 ?d("decode_al(signal) -> entry with" 1268 "~n SubItem: ~p", [SubItem]), 1269 case SubItem of 1270 [16#00, 16#02] -> "ri" 1271 end; 1272 1273decode_al({signal_parameter, Item}, SubItem) -> 1274 ?d("decode_al({signal_parameter,~p}) -> entry with" 1275 "~n SubItem: ~p", [Item, SubItem]), 1276 case Item of 1277 [16#00,16#02] -> %% Event: ri 1278 case SubItem of 1279 [16#00, 16#06] -> "cad"; 1280 [16#00, 16#07] -> "freq" 1281 end 1282 end. 1283 1284 1285%%---------------------------------------------------------------------- 1286%% Name: ct - Basic Continuity Package 1287%% Version: 1 1288%% Extends: None 1289%% Purpose: This package defines events and signals for continuity test. 1290%% The continuity test includes provision of either a loopback 1291%% or transceiver functionality. 1292%%---------------------------------------------------------------------- 1293 1294capabilities_ct() -> 1295 [ 1296 {event, "cmp"}, 1297 {signal, "ct"}, 1298 {signal, "rsp"} 1299 ]. 1300 1301encode_ct(event, Item) -> 1302 case Item of 1303 "cmp" -> [16#00, 16#05] 1304 end; 1305encode_ct({event_parameter, Item}, SubItem) -> 1306 case Item of 1307 "cmp" -> 1308 case SubItem of 1309 "res" -> [16#00, 16#08] 1310 end 1311 end; 1312encode_ct(signal, Item) -> 1313 case Item of 1314 "ct" -> [16#00, 16#03]; 1315 "rsp" -> [16#00, 16#04] 1316 end. 1317 1318decode_ct(event, Item) -> 1319 case Item of 1320 [16#00, 16#05] -> "cmp" 1321 end; 1322decode_ct({event_parameter, Item}, SubItem) -> 1323 case Item of 1324 [16#00, 16#05] -> % Event cmp 1325 case SubItem of 1326 [16#00, 16#08] -> "res" 1327 end 1328 end; 1329decode_ct(signal, Item) -> 1330 case Item of 1331 [16#00, 16#03] -> "ct"; 1332 [16#00, 16#04] -> "rsp" 1333 end. 1334 1335%%---------------------------------------------------------------------- 1336%% Name: nt - Network Package 1337%% Version: 1 1338%% Extends: None 1339%% Purpose: This package defines properties of network terminations 1340%% independent of network type. 1341%%---------------------------------------------------------------------- 1342 1343capabilities_nt() -> 1344 [ 1345 {property, "jit"}, 1346 {event, "netfail"}, 1347 {event, "qualert"}, 1348 {statistics, "dur"}, 1349 {statistics, "os"}, 1350 {statistics, "or"} 1351 ]. 1352 1353encode_nt(property, Item) -> 1354 case Item of 1355 "jit" -> [16#00, 16#07] 1356 end; 1357encode_nt(event, Item) -> 1358 case Item of 1359 "netfail" -> [16#00, 16#05]; 1360 "qualert" -> [16#00, 16#06] 1361 end; 1362encode_nt({event_parameter, Item}, SubItem) -> 1363 case Item of 1364 "netfail" -> 1365 case SubItem of 1366 "cs" -> [16#00, 16#01] 1367 end; 1368 "qualert" -> 1369 case SubItem of 1370 "th" -> [16#00, 16#01] 1371 end 1372 end; 1373encode_nt(statistics, Item) -> 1374 case Item of 1375 "dur" -> [16#00, 16#01]; 1376 "os" -> [16#00, 16#02]; 1377 "or" -> [16#00, 16#03] 1378 end. 1379 1380decode_nt(property, Item) -> 1381 case Item of 1382 [16#00, 16#07] -> "jit" 1383 end; 1384decode_nt(event, Item) -> 1385 case Item of 1386 [16#00, 16#05] -> "netfail"; 1387 [16#00, 16#06] -> "qualert" 1388 end; 1389decode_nt({event_parameter, Item}, SubItem) -> 1390 case Item of 1391 [16#00, 16#05] -> % Event netfail 1392 case SubItem of 1393 [16#00, 16#01] -> "cs" 1394 end; 1395 [16#00, 16#06] -> % Event qualert 1396 case SubItem of 1397 [16#00, 16#01] -> "th" 1398 end 1399 end; 1400decode_nt(statistics, Item) -> 1401 case Item of 1402 [16#00, 16#01] -> "dur"; 1403 [16#00, 16#02] -> "os"; 1404 [16#00, 16#03] -> "or" 1405 end. 1406 1407%%---------------------------------------------------------------------- 1408%% Name: rtp - RTP Package 1409%% Version: 1 1410%% Extends: nt version 1 1411%% Purpose: This package is used to support packet based multimedia 1412%% data transfer by means of the Real-time Transport Protocol 1413%% (RTP) [RFC 1889]. 1414%%---------------------------------------------------------------------- 1415 1416capabilities_rtp() -> 1417 [ 1418 {event, "pltrans"}, 1419 {statistics, "ps"}, 1420 {statistics, "pr"}, 1421 {statistics, "pl"}, 1422 {statistics, "jit"}, 1423 {statistics, "delay"} 1424 ]. 1425 1426encode_rtp(event, Item) -> 1427 case Item of 1428 "pltrans" -> [16#00, 16#01] 1429 end; 1430encode_rtp({event_parameter, Item}, SubItem) -> 1431 case Item of 1432 "pltrans" -> 1433 case SubItem of 1434 "rtppltype" -> [16#00, 16#01] 1435 end 1436 end; 1437encode_rtp(statistics, Item) -> 1438 case Item of 1439 "ps" -> [16#00, 16#04]; 1440 "pr" -> [16#00, 16#05]; 1441 "pl" -> [16#00, 16#06]; 1442 "jit" -> [16#00, 16#07]; 1443 "delay" -> [16#00, 16#08] 1444 end. 1445 1446decode_rtp(event, Item) -> 1447 case Item of 1448 [16#00, 16#01] -> "pltrans" 1449 end; 1450decode_rtp({event_parameter, Item}, SubItem) -> 1451 case Item of 1452 [16#00, 16#01] -> % Event pltrans 1453 case SubItem of 1454 [16#00, 16#01] -> "rtppltype" 1455 end 1456 end; 1457decode_rtp(statistics, Item) -> 1458 case Item of 1459 [16#00, 16#04] -> "ps"; 1460 [16#00, 16#05] -> "pr"; 1461 [16#00, 16#06] -> "pl"; 1462 [16#00, 16#07] -> "jit"; 1463 [16#00, 16#08] -> "delay" 1464 end. 1465 1466 1467%%---------------------------------------------------------------------- 1468%% Name: tdmc - TDM Circuit Package 1469%% Version: 1 1470%% Extends: nt version 1 1471%% Purpose: This package is used to support TDM circuit terminations. 1472%%---------------------------------------------------------------------- 1473 1474capabilities_tdmc() -> 1475 [ 1476 {property, "ec"}, 1477 {property, "gain"} 1478 ]. 1479 1480encode_tdmc(Scope, Item) -> 1481 case Scope of 1482 property -> 1483 case Item of 1484 "ec" -> [16#00, 16#08]; 1485 "gain" -> [16#00, 16#0a] 1486 end 1487 end. 1488 1489decode_tdmc(Scope, Item) -> 1490 case Scope of 1491 property -> 1492 case Item of 1493 [16#00, 16#08] -> "ec"; 1494 [16#00, 16#0a] -> "gain" 1495 end 1496 end. 1497 1498 1499%%---------------------------------------------------------------------- 1500%% Name: swb - SwitchBoard Package 1501%% Version: 1 1502%% Extends: none 1503%% Purpose: This package is used to support SwitchBoard specials 1504%%---------------------------------------------------------------------- 1505 1506capabilities_swb() -> 1507 [ 1508 {statistics, "fs"}, % Free slots 1509 {statistics, "as"} % Allocated slots 1510 ]. 1511 1512encode_swb(Scope, Item) -> 1513 case Scope of 1514 statistics -> 1515 case Item of 1516 "fs" -> [16#00, 16#00]; 1517 "as" -> [16#00, 16#01] 1518 end 1519 end. 1520 1521decode_swb(Scope, Item) -> 1522 case Scope of 1523 statistics -> 1524 case Item of 1525 [16#00, 16#00] -> "fs"; 1526 [16#00, 16#01] -> "as" 1527 end 1528 end. 1529 1530 1531%%---------------------------------------------------------------------- 1532%% Name: native - Pseudo package 1533%% Version: 1 1534%% Extends: None 1535%% Purpose: Native tags for media stream properties 1536%% 1537%% Parameters for Local descriptors and Remote descriptors are 1538%% specified as tag-value pairs if binary encoding is used for the 1539%% protocol. This annex contains the property names (PropertyID), the 1540%% tags (Property Tag), type of the property (Type) and the values 1541%% (Value).Values presented in the Value field when the field contains 1542%% references shall be regarded as "information". The reference 1543%% contains the normative values. If a value field does not contain a 1544%% reference then the values in that field can be considered as 1545%% "normative". 1546%% 1547%% Tags are given as hexadecimal numbers in this annex. When setting 1548%% the value of a property, a MGC may underspecify the value according 1549%% to one of the mechanisms specified in section 7.1.1. 1550%% 1551%% For type "enumeration" the value is represented by the value in brack- 1552%% ets, e.g., Send(0), Receive(1). 1553%%---------------------------------------------------------------------- 1554%% 1555%% C.6. IP 1556%% 1557%% ________________________________________________________________ 1558%% | PropertyID| Tag | Type | Value | 1559%% | IPv4 | 6001 | 32 BITS | Ipv4Address | 1560%% | IPv6 | 6002 | 128 BITS | IPv6 Address | 1561%% | Port | 6003 | Unsigned Int| Port | 1562%% | Porttype | 6004 | Enumerated | TCP(0),UDP(1),SCTP(2)| 1563%% |___________|____________|______________|_______________________| 1564%% 1565%% 1566%% C.11. SDP Equivalents 1567%% 1568%% ______________________________________________________________ 1569%% | PropertyID| Tag | Type | Value | 1570%% | SDP_V | B001| STRING| Protocol Version | 1571%% | SDP_O | B002| STRING| Owner-creator and session ID | 1572%% | SDP_S | B003| STRING| Sesson name | 1573%% | SDP_I | B004| STRING| Session identifier | 1574%% | SDP_U | B005| STRING| URI of descriptor | 1575%% | SDC_E | B006| STRING| email address | 1576%% | SDP_P | B007| STRING| phone number | 1577%% | SDP_C | B008| STRING| Connection information | 1578%% | SDP_B | B009| STRING| Bandwidth Information | 1579%% | SDP_Z | B00A| STRING| time zone adjustment | 1580%% | SDP_K | B00B| STRING| Encryption Key | 1581%% | SDP_A | B00C| STRING| Zero or more session attributes| 1582%% | SDP_T | B00D| STRING| Active Session Time | 1583%% | SDP_R | B00E| STRING| Zero or more repeat times | 1584%% | SDP_M | B00F| STRING| Media name and transport addr | 1585%% | | | | Reference: IETF RFC 2327 | 1586%% |___________|______|________|_________________________________| 1587%% 1588%%---------------------------------------------------------------------- 1589 1590capabilities_native() -> 1591 [ 1592 %% C.6. IP 1593 {property, "IPv4"}, 1594 {property, "IPv6"}, 1595 {property, "Port"}, 1596 {property, "Porttype"}, 1597 1598 %% C.11. SDP Equivalents 1599 {property, "v"}, 1600 {property, "o"}, 1601 {property, "s"}, 1602 {property, "i"}, 1603 {property, "u"}, 1604 {property, "e"}, 1605 {property, "p"}, 1606 {property, "c"}, 1607 {property, "b"}, 1608 {property, "z"}, 1609 {property, "k"}, 1610 {property, "a"}, 1611 {property, "t"}, 1612 {property, "r"}, 1613 {property, "m"} 1614 ]. 1615 1616encode_native(Scope, Item) -> 1617 case Scope of 1618 property -> 1619 case Item of 1620 %% IP 1621 "IPv4" -> [16#60, 16#01]; 1622 "IPv6" -> [16#60, 16#02]; 1623 "Port" -> [16#60, 16#03]; 1624 "Porttype" -> [16#60, 16#04]; 1625 1626 %% SDP 1627 "v" -> [16#b0, 16#01]; 1628 "o" -> [16#b0, 16#02]; 1629 "s" -> [16#b0, 16#03]; 1630 "i" -> [16#b0, 16#04]; 1631 "u" -> [16#b0, 16#05]; 1632 "e" -> [16#b0, 16#06]; 1633 "p" -> [16#b0, 16#07]; 1634 "c" -> [16#b0, 16#08]; 1635 "b" -> [16#b0, 16#09]; 1636 "z" -> [16#b0, 16#0a]; 1637 "k" -> [16#b0, 16#0b]; 1638 "a" -> [16#b0, 16#0c]; 1639 "t" -> [16#b0, 16#0d]; 1640 "r" -> [16#b0, 16#0e]; 1641 "m" -> [16#b0, 16#0f] 1642 end 1643 end. 1644 1645decode_native(Scope, [Type, Item]) -> 1646 case Scope of 1647 property -> 1648 case Type of 1649 16#60 -> 1650 case Item of 1651 16#01 -> "IPv4"; 1652 16#02 -> "IPv6"; 1653 16#03 -> "Port"; 1654 16#04 -> "Porttype" 1655 end; 1656 1657 16#b0 -> 1658 case Item of 1659 16#01 -> "v"; 1660 16#02 -> "o"; 1661 16#03 -> "s"; 1662 16#04 -> "i"; 1663 16#05 -> "u"; 1664 16#06 -> "e"; 1665 16#07 -> "p"; 1666 16#08 -> "c"; 1667 16#09 -> "b"; 1668 16#0a -> "z"; 1669 16#0b -> "k"; 1670 16#0c -> "a"; 1671 16#0d -> "t"; 1672 16#0e -> "r"; 1673 16#0f -> "m" 1674 end 1675 end 1676 end. 1677 1678%% ------------------------------------------------------------------- 1679 1680% error(Reason) -> 1681% erlang:error(Reason). 1682 1683