Module: kamailio
Branch: master
Commit: e2a08a77b03565c2bdc863f1aa7d9c5a22af4a7e
URL:
https://github.com/kamailio/kamailio/commit/e2a08a77b03565c2bdc863f1aa7d9c5…
Author: Julien Chavanton <jchavanton(a)gmail.com>
Committer: Julien Chavanton <jchavanton(a)gmail.com>
Date: 2019-10-17T14:50:31-07:00
pv: xavp_copy improved examples
---
Modified: src/modules/pv/doc/pv_admin.xml
---
Diff:
https://github.com/kamailio/kamailio/commit/e2a08a77b03565c2bdc863f1aa7d9c5…
Patch:
https://github.com/kamailio/kamailio/commit/e2a08a77b03565c2bdc863f1aa7d9c5…
---
diff --git a/src/modules/pv/doc/pv_admin.xml b/src/modules/pv/doc/pv_admin.xml
index c66f14df67..3fa032d864 100644
--- a/src/modules/pv/doc/pv_admin.xml
+++ b/src/modules/pv/doc/pv_admin.xml
@@ -290,22 +290,23 @@ $xavp(a=>x) = "a-0-x";
$xavp(a[0]=>y) = "a-0-y";
$xavp(a=>x) = "a-1-x";
$xavp(a[0]=>y) = "a-1-y";
-xinfo("$$xavp(a[0]) = [$xavp(a[0]=>x)][$xavp(a[0]=>y)]\n");
-xinfo("$$xavp(a[1]) = [$xavp(a[1]=>x)][$xavp(a[1]=>y)]\n");
+$xavp(a=>x) = "a-2-x";
+$xavp(a[0]=>y) = "a-2-y";
+
+xinfo("BEFORE $xavp(a[0]=>x) == [a-2-x] == $xavp(a[0]=>y) ==
[a-2-y]\n");
+xinfo("BEFORE $xavp(a[1]=>x) == [a-1-x] == $xavp(a[1]=>y) ==
[a-1-y]\n");
+xinfo("BEFORE $xavp(a[2]=>x) == [a-0-x] == $xavp(a[2]=>y) ==
[a-0-y]\n");
# reorder
$var(source_index) = 1;
$var(destination_name) = "b";
+xavp_copy("a", "2", "b");
xavp_copy("a", "$var(source_index)",
"$var(destination_name)");
xavp_copy("a", "0", "$var(destination_name)");
-xinfo("reordered: $$xavp(b[0]) =
[$xavp(b[0]=>x)][$xavp(b[0]=>y)]\n");
-xinfo("reordered: $$xavp(b[1]) =
[$xavp(b[1]=>x)][$xavp(b[1]=>y)]\n");
-# results in:
-# INFO: $xavp(a[0]) = [a-1-x][a-1-y]
-# INFO: $xavp(a[1]) = [a-0-x][a-0-y]
-# INFO: reordered: $xavp(b[0]) = [a-0-x][a-0-y]
-# INFO: reordered: $xavp(b[1]) = [a-1-x][a-1-y]
+xinfo("AFTER $xavp(b[0]=>x) == [a-0-x] == $xavp(b[0]=>y) ==
[a-0-y]\n");
+xinfo("AFTER $xavp(b[1]=>x) == [a-1-x] == $xavp(b[1]=>y) ==
[a-1-y]\n");
+xinfo("AFTER $xavp(b[2]=>x) == [a-2-x] == $xavp(b[2]=>y) ==
[a-2-y]\n");
...
</programlisting>
</example>
@@ -332,24 +333,24 @@ xinfo("reordered: $$xavp(b[1]) =
[$xavp(b[1]=>x)][$xavp(b[1]=>y)]\n");
<programlisting format="linespecific">
...
# Using xavp_copy to reorder an existing xavp stack inplace
-$xavp(a=>x) = "a-0-x";
-$xavp(a[0]=>y) = "a-0-y";
-$xavp(a=>x) = "a-1-x";
-$xavp(a[0]=>y) = "a-1-y";
-$xavp(a=>x) = "a-2-x";
-$xavp(a[0]=>y) = "a-2-y";
+$xavp(d=>x) = "d-0-x";
+$xavp(d[0]=>y) = "d-0-y";
+$xavp(d=>x) = "d-1-x";
+$xavp(d[0]=>y) = "d-1-y";
+$xavp(d=>x) = "d-2-x";
+$xavp(d[0]=>y) = "d-2-y";
-# INFO: NEW $xavp(a[0]) = [a-2-x][a-2-y]
-# INFO: NEW $xavp(a[1]) = [a-1-x][a-1-y]
-# INFO: NEW $xavp(a[2]) = [a-0-x][a-0-y]
+xinfo("NEW $xavp(d[0]=>x) == [d-2-x] and $xavp(d[0]=>y) ==
[d-2-y]\n");
+xinfo("NEW $xavp(d[1]=>x) == [d-1-x] and $xavp(d[1]=>y) ==
[d-1-y]\n");
+xinfo("NEW $xavp(d[2]=>x) == [d-0-x] and $xavp(d[2]=>y) ==
[d-0-y]\n");
-xavp_copy("a", "1", "c");
-xavp_copy("a", "2", "a", "1");
-xavp_copy("c", "0", "a", "2");
+xavp_copy("d", "0", "e");
+xavp_copy("d", "2", "d", "0");
+xavp_copy("e", "0", "d", "2");
-# INFO: AFTER $xavp(a[0]) = [a-2-x][a-2-y]
-# INFO: AFTER $xavp(a[1]) = [a-0-x][a-0-y]
-# INFO: AFTER $xavp(a[2]) = [a-1-x][a-1-y]
+xinfo("AFTER $xavp(d[0]=>x) == [d-0-x] $xavp(d[0]=>y) ==
[d-0-y]\n");
+xinfo("AFTER $xavp(d[1]=>x) == [d-1-x] $xavp(d[1]=>y) ==
[d-1-y]\n");
+xinfo("AFTER $xavp(d[2]=>x) == [d-2-x] $xavp(d[2]=>y) ==
[d-2-y]\n");
...
</programlisting>
</example>